https://pulumi.com logo
#automation-api
Title
# automation-api
t

tall-needle-56640

03/09/2021, 4:32 PM
I'm having an issue with Azure auth. Here's my code:
Copy code
var servicePrincipalId = Environment.GetEnvironmentVariable("AzureServicePrincipalId");
programArgs.EnvironmentVariables = new Dictionary<string, string>
{
    ["ARM_CLIENT_ID"] = servicePrincipalId,
    ["ARM_CLIENT_SECRET"] = Environment.GetEnvironmentVariable("AzureServicePrincipalKey"),
    ["ARM_TENANT_ID"] = Environment.GetEnvironmentVariable("AzureServiceTenantId"),
    ["ARM_SUBSCRIPTION_ID"] = Environment.GetEnvironmentVariable("AzureSubscriptionId"),
};

var upResult = await stack.UpAsync();
I know
ARM_SUBSCRIPTION_ID
is set to the correct value, but when I run (test in VS), it errors out saying it can't find the resource group. Turns out it is using the subscription ID I normally use (default), but why isn't it picking up the subscription ID I am setting?
Figured it out. I was creating the stack before setting the environment variables. Doh!