azurepowershelltemplatesarmrunbook

Deploy an Azrue VM from an ARM template via Powershell Runbook without downloading template


This article shows a tutorial how to deploy some resources from ARM templates in a powershell runbook. And as I understand, it will download the template and the parameters files in the specific path. But how can that work in an automated Runbook without having any directly attached storage to the automation account. Obviously, I'm misunderstanding something...

I mean the Get-AzureStorageFileContent command:

# Create a new context
$Context = New-AzureStorageContext -StorageAccountName $StorageAccountName - 
StorageAccountKey $StorageAccountKey

Get-AzureStorageFileContent -ShareName 'resource-templates' -Context 
$Context -path 'TemplateTest.json' -Destination 'C:\Temp'

$TemplateFile = Join-Path -Path 'C:\Temp' -ChildPath $StorageFileName

# Deploy the storage account
New-AzureRmResourceGroupDeployment -ResourceGroupName $ResourceGroupName - 
TemplateFile $TemplateFile -TemplateParameterObject $Parameters

Do you know how to understand this, or are there some better methods to reach the goal?


Solution

  • You can use -TemplateParameterUri and -TemplateUri and give publicly available urls that where the tempaltes are stored.