从Localhost作为虚拟应用程序服务身份向KeyVault进行身份验证 [英] Authenticate to KeyVault As Dummy App Service Identity from Localhost

查看:84
本文介绍了从Localhost作为虚拟应用程序服务身份向KeyVault进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我拥有在Azure App Service上托管的WebApp.它还使用KeyVault中的某些值.

I have WebApp which I host on Azure App Service. It also uses certain values from KeyVault.

WebApp使用AppService的托管服务身份对KeyVault进行身份验证,并在其有效的keyvault中分配身份权限.

WebApp authenticates to KeyVault using Managed Service Identity of AppService and assigning the identity permissions in keyvault it works.

但是,我还没有弄清楚,当我在localhost上调试时,如何解决这个问题或执行虚拟身份验证.因为本地主机无法直接对密钥库进行身份验证.

However, I am yet to figure out, how can I possibly get around this or perform dummy authentication when I am debugging on localhost. because localhost can't directly authenticate to keyvault.

任何想法都很棒.

推荐答案

如果要在本地主机上调试,可以使用

If we want to debug on the localhost, we could use Microsoft.Azure.Services.AppAuthentication to do that. For more information, please refer to this article.

var azureServiceTokenProvider = new AzureServiceTokenProvider();
var kv = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback));

注意:

  • If there is no Azure Services Authentication Extension installed, you could download and install the extension.
  • Give access Keyvault right to your account.

使用您的帐户登录

这篇关于从Localhost作为虚拟应用程序服务身份向KeyVault进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆