This is just a quick note to myself.  I spent some time figuring out how to fetch the subscription id within the current Azure CLI context.

This one-liner can save you some time:

$SUBSCRIPTION_ID = az account show --query id --output tsv

Cheers,
Toon

About me

Hi! I’m Toon Vanhoutte, a hands-on Azure architect – based in Belgium – with a big passion for teaching and helping people out. I’m happy to assist you during your Azure journey with high-quality advisory and I would love to teach you Azure’s possibilities via my tailored training courses.

Subscribe to the blog