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

cuddly-napkin-89521

06/02/2023, 7:34 AM
@proud-noon-87466 hello, I checked in Pulumi IA, and I got code from below :
Copy code
import pulumi
from pulumi_azure_native import core

current = core.get_subscription_invoker()

pulumi.export("subscription_id", current.subscription_id)
p

proud-noon-87466

06/02/2023, 1:32 PM
The AI gets it wrong every time. I did figure out the right way to do this
Copy code
from pulumi_azure_native import authorization

# Retrieve the Azure subscription ID
subscription_id = authorization.get_client_config().subscription_id

# Export the subscription ID
pulumi.export("subscription_id",  subscription_id)
m

many-television-17079

06/15/2023, 7:23 PM
Be careful, in Typescript package the subId comes from the environment variables. When we changed the login mode to OIDC, the variable does not need to exist anymore and the authorization package fails to retrieve the subId.