I have published a web app locally and hooked it up to IIS.
When I try to navigate to the site it fails at startup with the following error when trying to access the keyvault:
Application startup exception:
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.
Unable to connect to the Managed Service Identity (MSI) endpoint.
Please check that you are running on an Azure resource that has MSI setup.
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 Visual Studio.
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"
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'
I had this problem and finally found that I wasn't logged in to Azure locally.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With