获取密钥库的访问令牌 [英] Fetching access token for keyvault

查看:52
本文介绍了获取密钥库的访问令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在本地发布了一个Web应用程序,并将其连接到IIS.

I have published a web app locally and hooked it up to IIS.

当我尝试导航到该站点时,它在启动时失败,并尝试访问 keyvault 时出现以下错误:

When I try to navigate to the site it fails at startup with the following error when trying to access the keyvault:

应用程序启动异常:

Microsoft.Azure.Services.AppAuthentication.AzureServiceTokenProviderException:参数:连接字符串:[未指定连接字符串],资源: https://vault.azure.net ,权限: https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47.异常消息:尝试了以下3种方法来获得访问权限令牌,但没有一个起作用.参数:连接字符串:[否指定的连接字符串],资源: https://vault.azure.net ,权威: https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47.异常消息:尝试使用托管服务标识获取令牌.

Microsoft.Azure.Services.AppAuthentication.AzureServiceTokenProviderException: Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47. Exception Message: Tried the following 3 methods to get an access token, but none of them worked. Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47. Exception Message: Tried to get token using Managed Service Identity.

无法连接到托管服务标识(MSI)端点.

Unable to connect to the Managed Service Identity (MSI) endpoint.

请检查您是否在具有MSI的Azure资源上运行设置.

Please check that you are running on an Azure resource that has MSI setup.

参数:连接字符串:[未指定连接字符串],资源: https://vault.azure.net ,权限: https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47.

Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47.

异常消息:尝试使用Visual Studio获取令牌.

Exception Message: Tried to get token using Visual Studio.

无法获取访问令牌.Visual Studio令牌提供程序文件在找不到"C:\ WINDOWS \ system32 \ config \ systemprofile \ AppData \ Local.IdentityService \ AzureServiceAuth \ tokenprovider.json"

Access token could not be acquired. Visual Studio Token provider file not found at "C:\WINDOWS\system32\config\systemprofile\AppData\Local.IdentityService\AzureServiceAuth\tokenprovider.json"

参数:连接字符串:[未指定连接字符串],资源: https://vault.azure.net ,权限: https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47.配置(最近通话最近一次):
_run_module_as_main
中的文件"runpy.py",第193行_run_code
中的文件"runpy.py",第85行第32行的文件"C:\ Users \ VSSADM〜1 \ AppData \ Local \ Temp \ pip-install-qw7dqhq0 \ azure-cli \ azure \ cli__main __.py"get_default_cli
中的第511行的文件"C:\ Users \ VSSADM〜1 \ AppData \ Local \ Temp \ pip-install-qw7dqhq0 \ azure-cli-core \ azure \ cli \ core__init __.py" init 中的文件"C:\ Users \ VSSADM〜1 \ AppData \ Local \ Temp \ pip-install-qw7dqhq0 \ azure-cli-core \ azure \ cli \ core__init __.py",第34行.
init 中的文件"C:\ Program Files(x86)\ Microsoft SDKs \ Azure \ CLI2 \ Lib \ site-packages \ knack \ cli.py",行82 self.config = config_cls(config_dir= config_dir,config_env_var_prefix = config_env_var_prefix)文件"C:\ Program Files(x86)\ Microsoft SDKs \ Azure \ CLI2 \ Lib \ site-packages \ knack \ config.py",第38行,在 init 中,请确保_dir(config_dir)
确保文件"C:\ Program Files(x86)\ Microsoft SDKs \ Azure \ CLI2 \ Lib \ sitepackages \ knack \ util.py"第38行,位于sure_dir os.makedirs(d)
makedirs中的文件"os.py",第220行,PermissionError:[WinError 5]访问被拒绝:'C:\ WINDOWS \ system32 \ config \ systemprofile \ .azure'

Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47. config (most recent call last):
File "runpy.py", line 193, in _run_module_as_main
File "runpy.py", line 85, in _run_code
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qw7dqhq0\azure-cli\azure\cli__main__.py", line 32, in File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qw7dqhq0\azure-cli-core\azure\cli\core__init__.py", line 511, in get_default_cli
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qw7dqhq0\azure-cli-core\azure\cli\core__init__.py", line 34, in init
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\knack\cli.py", line 82, in init self.config = config_cls(config_dir=config_dir, config_env_var_prefix=config_env_var_prefix) File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\knack\config.py", line 38, in init ensure_dir(config_dir)
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\sitepackages\knack\util.py", line 38, in ensure_dir os.makedirs(d)
File "os.py", line 220, in makedirs PermissionError: [WinError 5] Access is denied: 'C:\WINDOWS\system32\config\systemprofile\.azure'

推荐答案

我遇到了这个问题,最后发现我没有本地登录到Azure.

I had this problem and finally found that I wasn't logged in to Azure locally.

为我解决的问题是将Azure CLI下载到我的计算机上并运行

What fixed the issue for me was downloading the Azure CLI to my machine and running

az login

,只需按照结果页面登录即可.运行您的应用程序,您应该会发现它现在已连接.

and just follow the resultant pages to login in. Run your app and you should find it connects now.

这篇关于获取密钥库的访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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