Azure Resource Manager (ARM) Template | Python
This example simply deploys an existing Azure Resource Manager (ARM) template using Pulumi. This accepts any existing valid ARM template, enabling easy migration from existing JSON templates and towards infrastructure as code using Pulumi. Once deployed, it is easy to incrementally refactor resources at a time out of the template and into code.
Read more about ARM templates here.
Ensure you have downloaded and installed the Pulumi CLI.
We will be deploying to Azure, so you will need an Azure account. If you don’t have an account, sign up for free here. Follow the instructions here to connect Pulumi to your Azure account.
Running the App
Create a new stack:
$ pulumi stack init Enter a stack name: azure-arm-dev
Set the required configuration variables for this program, and log into Azure:
$ pulumi config set azure:environment public $ pulumi config set azure:location westus2 $ az login
Perform the deployment:
$ pulumi up Updating stack 'azure-arm-dev' Performing changes: Type Name Status + pulumi:pulumi:Stack azure-arm--azure-arm-dev created + ├─ azure:core:ResourceGroup rg created + └─ azure:core:ResourceGroupTemplateDeployment arm-dep created Outputs: storageAccountName: "abevrwebgje2wstorage" Resources: + 3 created Duration: 1m8s
Notice here that the
storageAccountNameallocated by the ARM template deployment is exported.
Tidy up and delete all resources allocated by your deployment:
$ pulumi destroy -y --skip-preview $ pulumi stack rm -y
For more Azure examples, please check out the Azure Getting Started Guide.