Can't create VM from image standard security type in Azure in runbooks
Hello,
I've created a runbook that manages my machines automatically and deploys them via a managed image.
During the development, I had a problem during my scripting because my master machines were in TrustedLaunched SecurityType. So I recreated an image with Standard SecurityType and my script worked perfectly.
When I run the same script from the Runbook, the error comes back, but this time for Standard.
For me, it has no sense and i can't find any documentation about that problem.
Can you explain me the problem or give me a solution please ?
I tried to open a ticket on Github but Microsoft don't get back to me (https://github.com/Azure/azure-powershell/issues/23756)
Thank you in advance for your help
Issue script & Debug output
Write-Output "Creating VDI $tmpName..."
$nic = New-AzNetworkInterface -ResourceGroupName $rgName -Location $location -Name "$tmpName-NIC" -SubnetId (Get-AzVirtualNetwork -ResourceGroupName $rgName -Name $vnetName).Subnets[0].Id -NetworkSecurityGroupId (Get-AzResource -ResourceGroupName $rgName -Name $nsgName).ResourceId -Force
$tmpConfig = New-AzVMConfig -VMName "$tmpName-VM" -VMSize $masterVM.HardwareProfile.Vmsize -IdentityType "SystemAssigned"
$tmpConfig = Set-AzVMSecurityProfile -VM $tmpConfig -SecurityType "Standard"
$tmpConfig = Set-AzVMOSDisk -VM $tmpConfig -Name "$tmpName-OSDisk" -Windows -CreateOption "FromImage"
$tmpConfig = Set-AzVMSourceImage -VM $tmpConfig -Id $masterImage.Id
$tmpConfig = Set-AzVMOperatingSystem -VM $tmpConfig -Windows -ComputerName $tmpName -Credential $creds
$tmpConfig = Set-AzVMBootDiagnostic -VM $tmpConfig -Disable
$tmpConfig = Add-AzVMNetworkInterface -VM $tmpConfig -Id $nic.Id
New-AzVM -VM $tmpConfig -ResourceGroupName $rgName -Location $location -Zone $masterVM.Zones
Error output
Error : {Managed Images are not supported for virtual machines with security type Standard.
ErrorCode: BadRequest
ErrorMessage: Managed Images are not supported for virtual machines with security type Standard.
ErrorTarget:
StatusCode: 400
ReasonPhrase:
OperationID: 76601d3d-d902-4b4f-b8fc-ab1f743c8f79}