1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | Install-Module Az -AllowClobber -force Import-Module Az Connect-AzAccount #Define variables, use the same resource names that were migrated $pipname = "everest-ip" $nicname = "everest263" $vnetName = "Rokklike_group-vnet" $rg = "Rokklike_group" $loc = "UK West" #Create Public IP $pip = New-AzPublicIpAddress -Name $pipname -ResourceGroupName $rg -Location $loc -AllocationMethod Dynamic $pip = Get-AzPublicIpAddress -Name $pipname -ResourceGroupName $rg #Identify VNet, subnet, nic names that were migrated. And assign PIP to nic $vnet = get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rg $subnet = Get-AzVirtualNetworkSubnetConfig -Name "default" -VirtualNetwork $vnet $nic = get-AzNetworkInterface -Name $nicname -ResourceGroupName $rg $nic | Set-AzNetworkInterfaceIpConfig -Name ipconfig1 -PublicIPAddress $pip -Subnet $subnet $nic | Set-AzNetworkInterface #Define VM size and attach nic $vm = New-AzVMConfig -VMName "everest" -VMSize "Standard_B2ms" $vm = Add-AzVMNetworkInterface -VM $vm -Id $nic.Id #Define your plan, for this you will need Publisher, Product and Name saved from old subscription Set-AzVMPlan -VM $vm -Publisher "procomputers" -Product "centos-7-9" -Name "centos-7-9" Get-AzMarketPlaceTerms -Publisher "procomputers" -Product "centos-7-9" -Name "centos-7-9" | Set-AzMarketPlaceTerms -Accept #Provide the name of the OS disk from where VM will be created $osDiskName = "everest_OsDisk_1_ef2d47db3a114a1b91a4a224e37ceca6" $disk = Get-AzDisk -DiskName $osDiskName -ResourceGroupName $rg $vm = Set-AzVMOSDisk -VM $vm -ManagedDiskId $disk.Id -CreateOption Attach -Linux #Create new VM New-AzVM -ResourceGroupName $rg -Location $loc -VM $vm |