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

icy-dress-83371

03/25/2021, 2:13 PM
Anyone know if it is possible to reference your `azure-native:subscriptionId`variable from the yaml config from inside code?
config.get(subscriptionId)
would only look under the context of the project name
b

brave-planet-10645

03/25/2021, 2:16 PM
So the config is namespaced.
Copy code
const config = new pulumi.Config();
will give you config under the namespace of the project name
Copy code
const config = new pulumi.Config("azure-native");
const subscriptionId = config.get(subscriptionId);
will give you the azure-native config
💯 1
and if you ran
Copy code
pulumi config set mycustomnamespace:configitem
Then you'd use
Copy code
const config = new pulumi.Config("mycustomnamespace");
i

icy-dress-83371

03/25/2021, 2:18 PM
ahh, that is exactly what I was looking for, not sure why that thought didn't even cross my mind... Thanks!
t

tall-librarian-49374

03/25/2021, 2:27 PM
A more general way - in case you don’t have it in your config - would be to all
getClientConfig
like in https://github.com/pulumi/examples/blob/2e9e18b36a9720dd0e691f2bfe883bbfd46bd512/azure-ts-synapse/index.ts#L63
That function returns a
subscriptionId
and some other parameters https://www.pulumi.com/docs/reference/pkg/azure-native/authorization/getclientconfig/
3 Views