https://pulumi.com logo
#azure
Title
# azure
m

many-morning-3811

01/12/2024, 9:49 PM
This might be a noob question -> How do you get the subscription id set directly to azure-native provider in the config from the code for ex I have a config like below
Copy code
config:
  azure-native:location: EastUS
  azure-native:subscriptionId: 4f85f91d-f079-4a1e-bed7-8af80f509048
  azure-native:tenantId: c74dda19-ecf9-4f61-8586-2bddb1f14324
i need to read the location, subscriptionId, tenantId from the go code. How do I do that?
m

millions-journalist-34868

01/12/2024, 10:30 PM
Personally I don't put them in my configuration but I can get the current subscription id used with the following code:
Copy code
const azureConfig = pulumi.output(authorization.getClientConfig());
const subscriptionId = azureConfig.subscriptionId;
for the configuration set in the yaml file, according to the documentation you could do something like that:
Copy code
let awsConfig = new pulumi.Config("azure-native");
let subscriptionId = awsConfig.require("subscriptionId");
m

many-morning-3811

01/12/2024, 11:12 PM
Ok thanks
m

millions-journalist-34868

01/13/2024, 7:53 AM
Yes it does.
m

many-morning-3811

01/14/2024, 6:26 PM
Yep I changed also converted the demo into a template you can check it out here -> https://github.com/rprakashg-redhat/pulumi-aro