https://pulumi.com logo
Title
d

dazzling-gigabyte-42983

10/31/2022, 1:03 PM
Is there any easy way to get the current subscription Id when running the code. I want the subscription ID associated with the login (Az Login - Azure). I'm trying to allow devs to point at their own MSDN Subscription so this would be ideal rather than putting it in config
r

ripe-russia-4239

10/31/2022, 1:41 PM
If this is their default subscription (as indicated by
az account list -otable
) then this will be targeted without any need for further config. It's a bit unstable though: it will change if/when the dev changes their
az
config. Alternatively, you can use the
GetClientConfig.InvokeAsync()
method, which returns the subscription ID on its result.
m

mammoth-agency-10350

10/31/2022, 3:38 PM
+1 for
GetClientConfig
. I use it to verify the current set subscription is the one in the stack config for the running stack.