Posts

Showing posts from March, 2019

Azure Stack Powershell - Create a VM using uploaded VHD

The script will use existing resources(RG/NIC) Azure Stack $location = "YOURLOCATION" $rgname = "YOURRG" $vmname = "YOURVMNAME" $osVHD = "https://FQDN/storageaccount/osdiskname.vhd" $vm = New-AzureRmVMConfig -VMName $vmname -VMSize "Standard_A4_v2" $vm = Set-AzureRmVMOSDisk -VhdUri $osVHD -Name $vmname-OSDisk -CreateOption attach -Linux -Caching ReadWrite -VM $vm1 $nic = get-azurermnetworkinterface -name $vmname-NIC1 -ResourceGroupName $rgname $vm1 = Add-AzureRmVMNetworkInterface -VM $vm1 -ID $nic.id New-AzureRMVM -ResourceGroupName $rgname -Location $location $vm1 -Verbose Azure Create a virtual machine using an existing managed OS disk with PowerShell