Linux : script to create VMSS from SIG Image I am getting a failure which indicates WindowsAttestation is being installed on Linux VM I am passing Image Ref of Linux Sig Image. Also OSType as Linux. It is working fine when I pass Windows SIG Image reference and OSType as Windows.
I don't understand what's the issue with Linux.
$imageref = ""
$resourceGroupName = "myrg"
$location = region
$vnetName = "my-vnet"
$vmssNetwork = "my-net"
$computerName = "myvm"
$securityType = "TrustedLaunch"
$ipName = "my-ip"
$VMSSName = "my vmss"
$SkuName = "Standard_D2s_v3"
$osType = "Linux"
$adminUser = "AdminUsername"
$adminPass = "Adminpassword"
# create resource group
New-AzResourceGroup -ResourceGroupName $resourceGroupName -Location $location
# vnet
$frontendSubnet = New-AzVirtualNetworkSubnetConfig -Name "frontendSubnet" -AddressPrefix "10.0.1.0/24"
$backendSubnet = New-AzVirtualNetworkSubnetConfig -Name "backendSubnet" -AddressPrefix "10.0.2.0/24"
$vnet = New-AzVirtualNetwork -Name $vnetName -ResourceGroupName $resourceGroupName -Location $location -AddressPrefix "10.0.0.0/16" -Subnet $frontendSubnet,$backendSubnet
$vnet = Get-AzureRmVirtualNetwork -ResourceGroupName $resourceGroupName -Name $vnetName
#ipconfig
$ipConfig = New-AzureRmVmssIpConfig -Name $ipName -LoadBalancerBackendAddressPoolsId $null -SubnetId $vnet.Subnets[0].Id
# vmss configuration
$vmss = New-AzureRmVmssConfig -Location $location -SkuCapacity 2 -SkuName $SkuName -UpgradePolicyMode "Automatic" -ErrorAction Stop
$vmss1 = Set-AzVmssSecurityProfile -VirtualMachineScaleSet $vmss -SecurityType $securityType;
# network interface config
Add-AzureRmVmssNetworkInterfaceConfiguration -VirtualMachineScaleSet $vmss1 -Name $vmssNetwork -Primary $true -IPConfiguration $ipConfig
# set the stroage profile
Set-AzureRmVmssStorageProfile -VirtualMachineScaleSet $vmss1 -OsDiskCreateOption "FromImage" -OsDiskCaching "None" -ImageReferenceId $imageref -OsDiskOsType $osType
# os profile
Set-AzureRmVmssOSProfile -ComputerNamePrefix $computerName -AdminUsername $adminUser -AdminPassword $adminPass -VirtualMachineScaleSet $vmss1
#create the vmss
New-AzVMss -ResourceGroupName $resourceGroupName -Name $VMSSName -VirtualMachineScaleSet $vmss1
You seem to be trying to create a Virtual Machine Scale Set (VMSS) using PowerShell and Azure PowerShell cmdlets. However, there appears to be a mix of AzureRM (Azure Resource Manager) and Az (Az module) cmdlets in your script, which could be causing compatibility issues.
However, I tried the same code and faced the errors again. So I changed the approach for commands as shown below
my PowerShell script
VM image
Output