-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Description
Hi Team, I have a sample functions app (dotnet-isolated) and I am using an app (client id, client secret) to authenticate to a twin instance. When I run my function locally it works just fine but once deployed it just fails with a 403 error. I have verified that my client has the required access control as per this doc.
here is the sample code I use for authentication
string adtInstanceUrl = Environment.GetEnvironmentVariable("clientConfig:digitalTwins:instanceUrl");
string tenantId = Environment.GetEnvironmentVariable("clientConfig:servicePrinciple:tenantId");
string clientId = Environment.GetEnvironmentVariable("clientConfig.servicePrinciple.clientId");
string clientSecret = Environment.GetEnvironmentVariable("clientConfig:servicePrinciple:clientSecret");
Environment.SetEnvironmentVariable("AZURE_CLIENT_SECRET", clientSecret);
Environment.SetEnvironmentVariable("AZURE_CLIENT_ID", clientId);
Environment.SetEnvironmentVariable("AZURE_TENANT_ID", tenantId);
TokenCredential tokenCredential = new DefaultAzureCredential();
var client = new DigitalTwinsClient(new Uri(adtInstanceUrl),
tokenCredential);
Metadata
Metadata
Assignees
Labels
No labels