My .net framework web form application deployed on iis server not able to connect to azure key vault on azure portal. It is on 4.8. Application is working fine on localhost but it is showing error as mentioned belowServer Error in '/' Application. Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: The configBuilder 'AppsettingAzureKeyVault' failed while processing the configuration section 'appSettings'.: 'AppsettingAzureKeyVault' GetAllValues() Error: DefaultAzureCredential failed to retrieve a token from the included credentials. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/defaultazurecredential/troubleshoot - EnvironmentCredential authentication unavailable. Environment variables are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/environmentcredential/troubleshoot - ManagedIdentityCredential authentication unavailable. Multiple attempts failed to obtain a token from the managed identity endpoint. - Visual Studio Token provider can't be accessed at C:\Users\applicayionurl\AppData\Local.IdentityService\AzureServiceAuth\tokenprovider.json - Azure CLI not installed - Az.Account module >= 2.2.0 is not installed. Source Error: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Source File: D:\Websites\Develop\web.config
I had added the required dll from night for azure keyvault. Also added the config builder and set the app settings and connection string accordingly.
I had added all the required setting in iis pool like application client I'd, azure tenant I'd, azure secrets. I had followed the below link https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication-on-premises-apps?tabs=azure-portal%2Ciis-app-pool%2Ccommand-line
You need to deploy the Web App in IIS created in
Azure VM.First create an Azure VM in Portal.
Enable
Managed Identityunder Management.Download the RDP from the
Connecttab.Connect to the VM using RDP from the App or by running the Downloaded RDP file.
Open the VM.
Click on
Windows=> search forServer Managerand click onAdd Roles and Features Wizard.inetmgrin the VM and deploy the App to IIS.You can refer the code to retrieve Azure Key Vault secrets from .NET Framework App here 1 and 2.