I have the following connection string to connect to a Datamart server.
@"Server=datamartservername; Authentication=Active Directory Interactive; Encrypt=True; Database=dbname";
It works fine when I run the application in Visual Studio. I get the pop up window to authenticate as intended.
However, when I build the installer and release it to other users. The application crashes instead of opening up the pop up window to authenticate.
What would be the issue?
Your application needs to have an identity to be able to reach the Azure Services. this credential (App Registration/Service Principal) can be provided to the application in many different way, for example via the environment variables (AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID).
Do look at the DefaultAzureCredential class https://learn.microsoft.com/en-us/dotnet/api/azure.identity.defaultazurecredential?view=azure-dotnet