Is there a way to enable the Auto-start feature on a DevTest Labs virtual machine as part of the creation i.e. can it be added to the VM's ARM template?
I enable this manually via the Azure portal currently, but I'm finding that it gets disabled when subsequent deployments from Team Services are made.
Solution
Inspired by the accepted answer from Ashok below, I've managed to tweak and simplify the PowerShell script to the following...
Param([string] $resourceId)
$tags = (Get-AzureRmResource -ResourceId $resourceId).Tags
if (-Not ($tags) -Or -Not($tags.ContainsKey('AutoStartOn'))) {
$tags += @{ AutoStartOn=$true; }
}
if (-Not ($tags) -Or -Not($tags.ContainsKey('AlwaysOn'))) {
$tags += @{ AlwaysOn=$true; }
}
Set-AzureRmResource -ResourceId $resourceId -Tag $tags -Force