Search code examples
c#azure-configuration

How to connect app running on VM to Azure Configuration


I'm having trouble getting my app to connect to an Azure Configuration (AC) I setup for the app. Here are some details regarding the issue:

  • The app is hosted on an Azure virtual machine (VM) in a different subscription.
  • I am attempting to connect to the AC like in the below code, which is basically how the Microsoft documentation shows.
var builder = new ConfigurationBuilder();
builder.AddAzureAppConfiguration(appConfigConnstring);
Config = builder.Build();
  • This works fine when I run my app on localhost, I am able to connect and retrieve values from the AC. It does not work when running from the app server.
  • The error message I get is "The provider timed out while attempting to load."

I've searched online for more info on this but can't seem to find any forum or documentation regarding this scenario, so any help is much appreciated.


Solution

  • This turned out to be an issue with not having a private endpoint. Once I added a private endpoint to the Azure Configuration it worked.

    This can be done through infrastructure as code (IaC) if you have code for it, or if not it can be done in the Azure portal by going to the Configuration, then from the left side menu access Settings >Networking >Private Access, then click the "+ Create" button to add a private end point.