Skip Navigation

VM Using Managed Identity for Artifact Download

Last updated: 9/10/2021

This template shows how to use a managed identity to download artifacts for the virtual machine's custom script extension.

This Azure Resource Manager template was created by a member of the community and not by Microsoft. Each Resource Manager template is licensed to you under a license agreement by its owner, not Microsoft. Microsoft is not responsible for Resource Manager templates provided and licensed by community members and does not screen for security, compatibility, or performance. Community Resource Manager templates are not supported under any Microsoft support program or service, and are made available AS IS without warranty of any kind.

Parameters

Parameter Name Description
adminUsername Username for the Virtual Machine.
adminPassword Password for the Virtual Machine.
vmSize Size of the virtual machine
location Location for all resources.
fileUris An array of fileUris to download via the custom script extension
identityName name for the managedIdenity to use for custom script download, the principal must have at least storage blob reader permission on the storage account, roleDef: 2a2b9908-6ea1-4ae2-8e65-a410df84e7d1
identityResourceGroup resourceGroup for the managedIdenity to use for custom script download
alwaysRun For the sample, use this to ensure the extension will always execute.

Use the template

PowerShell

New-AzResourceGroup -Name <resource-group-name> -Location <resource-group-location> #use this command when you need to create a new resource group for your deployment
New-AzResourceGroupDeployment -ResourceGroupName <resource-group-name> -TemplateUri https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/demos/vm-cse-msi/azuredeploy.json
Install and configure Azure PowerShell

Command line

az group create --name <resource-group-name> --location <resource-group-location> #use this command when you need to create a new resource group for your deployment
az group deployment create --resource-group <my-resource-group> --template-uri https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/demos/vm-cse-msi/azuredeploy.json
Install and Configure the Azure Cross-Platform Command-Line Interface