Azure Resource Manager (ARM) template
An example of deploying an Azure Resource Manager (ARM) template using Pulumi.
This example lives in the pulumi/examples repository. Check out just this directory to use it:
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examplesgit -C pulumi-examples sparse-checkout set classic-azure-py-arm-templatecd pulumi-examples/classic-azure-py-arm-templateThis 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.
Prerequisites#
Deploying the example#
-
Create a new stack:
Terminal window pulumi stack init -
Set the required configuration variables for this program, and log into Azure:
Terminal window pulumi config set azure:environment publicpulumi config set azure:location westus2pulumi config set azure:subscriptionId <YOUR_SUBSCRIPTION_ID>az login -
Install dependencies:
Terminal window python3 -m venv venvsource venv/bin/activatepip install -r requirements.txt -
Perform the deployment:
Terminal window pulumi upUpdating 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 createdOutputs:storageAccountName: "abevrwebgje2wstorage"Resources:+ 3 createdDuration: 1m8sNotice here that the
storageAccountNameallocated by the ARM template deployment is exported.
Cleaning up#
Once you are done, destroy all of the resources and the stack:
pulumi destroypulumi stack rmNext steps#
For more Azure examples, please check out the Azure Getting Started Guide.