Create an Azure resource group and return the Azure subscriptionId
-
Login to Azure CLI (you will be prompted to do this during deployment if you forget this step)
az login
-
Create a new stack
pulumi stack init dev
-
Install dependencies
npm install
-
Configure the location to deploy the resources to. The Azure region to deploy to is pre-set to WestUS - but you can modify the region you would like to deploy to.
pulumi config set azure-native:location eastus2
-
Create that stack via
pulumi up
pulumi up -y
Results
Previewing update (dev) View Live: https://app.pulumi.com/myuser/azure-ts-subscriptionid-from-resourcegroup/dev/previews/0c785e89-b887-48e2-8fb3-fdd78ea9d749 Type Name Plan + pulumi:pulumi:Stack azure-ts-subscriptionid-from-resourcegroup-dev create + └─ azure-native:resources:ResourceGroup demo-rg create Resources: + 2 to create Updating (dev) View Live: https://app.pulumi.com/myuser/azure-ts-subscriptionid-from-resourcegroup/dev/updates/5 Type Name Status + pulumi:pulumi:Stack azure-ts-subscriptionid-from-resourcegroup-dev created + └─ azure-native:resources:ResourceGroup demo-rg created Outputs: myresourcegroup_name: "demo-rg9f01d49b" subscriptionid : "[secret]" Resources: + 2 created Duration: 5s
-
View the outputs created via pulumi stack output
pulumi stack output
Results
Current stack outputs (2): OUTPUT VALUE myresourcegroup_name demo-rg9f01d49b subscriptionid [secret]
-
The outputs are secrets. To view them run the following
pulumi stack output --show-secrets
The Subscription ID will show up.
-
Clean up - Destroy the Stack
pulumi destoy -y
-
Remove the stack
pulumi stack rm dev