Skip to main content

Deploying a VM Using Disk Snapshot

Hey Folks,

Hope you are doing great, Thought of posting this article, because of a recent experiance I had. We wanted to move a particular VM from one Vnet to another VM. So we thought of taking a down time and Get a disk snapshot and re-reploy the VM in the second VNet.

But, unfortuanly Azure threw and error saying.

And I noticed, VM is getting deployed but we cannot power it on. And When I dig deepeer I saw VM publisher information was easy.

I was able to find many articles mentioning about this, but all the articles shows how to deploy the VM in a vanila environment. So I had to a tweek this a little bit

So we had to follow the below process using poweshell.

Collocting the required information from source VM

$vm = Get-azvm -ResourceGroupName "AE-DEV-SONUS-RG" -Name AERibbonVM


Setting up Basic VM Config for the New VM

$vmconfig = New-AzVMConfig -VMName ribbonTemp2 -VMSize Standard_B1ms

Create a disk from the snapshot

$snapshot = Get-AzSnapshot -ResourceGroupName "AE-DEV-SONUS-RG" -SnapshotName RibbonSnap
$diskconfig = New-AzDiskConfig -Location “Australia East” -SourceResourceId $snapshot.Id -CreateOption Copy
$newdisk = New-AzDisk -Disk $diskconfig -ResourceGroupName "AE-DEV-SONUS-RG" -DiskName "RibbonDisk02"

$vmconfig = New-AzVMConfig -VMName ribbonTemp2 -VMSize Standard_B1ms
$vmconfig = Set-AzVMOSDisk -VM $vmconfig -ManagedDiskId $newdisk.Id -CreateOption Attach -Linux

Get Avaible Virtual Networks

$vnet = Get-AzVirtualNetwork -Name "AE-DEV-SONUS-RG-vnet" -ResourceGroupName "AE-DEV-SONUS-RG"
$subnet = Get-AzVirtualNetworkSubnetConfig -Name default -VirtualNetwork $vnet

Creating NIC For the NEW VM

$vmnic = New-AzNetworkInterface -Name “Ribbon_nic2” -ResourceGroupName "AE-DEV-SONUS-RG" -Location “Australia East” -SubnetId $subnet.Id

$vmconfig = Add-AzVMNetworkInterface -VM $vmconfig -Id $vmnic.Id

Setting Up the publisher inforamtion

$vmConfig = Set-AzVMPlan -VM $vmConfig -Publisher "ribboncommunications" -Product "ribbon_sbc_swe-lite_vm" -Name "ribbon_sbc_swe-lite_vm_release"

Creating New VM

New-AzVM -VM $vmconfig -ResourceGroupName "AE-DEV-SONUS-RG" -Location “Australia East”

Hope this helps you. :)


  1. Will this be same when we plan to migrate a vm from one subscription to another in a different tenant? Source VM is a linux centos.

  2. I belive that wont be the case, This was when we had to move to a diffrent VNet, irrespetive of the subscription. if you taking a snapshot and moving the disk, it wont carry the plan information. and you wont be able to update them once the VM is provisioned, eventhough MS article says we can set the plan infromation. that did not worked for us


Post a Comment

Popular posts from this blog

Deploying an Automation Account with a Runbook and Schedule Using Bicep

Introduction Automation is a key component in many organizations' cloud strategy. Azure Automation allows you to automate the creation, deployment, and management of resources in your Azure environment. In this post, we will walk through the process of deploying an Automation Account with a Runbook and Schedule using Bicep, a new domain-specific language for deploying Azure resources. Intention My intention at the  end is to run a PowerShell  script to start and shutdown Azure VMs based on tag values. PowerShell  script that I have used is from below l ink.  And two  of me   collogue s ( Michael Turnley   and Saudh Mohomad helped to modify the  PowerShell  script. Prerequisites Before we begin, you will need the following: An Azure subscription The Azure CLI installed on your machine. The Azure Bicep extension for the Azure CLI Creating the Automation Account The first step in deploying an Automation Account with a Runbook and Schedule is to create the Aut

Migrating Azure DevOps Variable Groups

Howdy Folks, I was working on an application modernization project. And there was a requirement to migrate application deployments from one project to another in Azure DevOps. deployment pipelines were heavily dependent on variable groups. So, we wanted to migrate these variables group to the new project. Couldn't find any solutions in internet for this, so came up with the below scripts. You can grab the scripts from the below GitHub URL. DaniduWeerasinghe911/Migrate-Azure-DevOps-Variable-Groups: This Repo Include PowerShell Scripts relating to Migrating Azure DevOps Variable Groups ( Azure DevOps Variable Groups Azure DevOps Variable Groups are a way to store and manage sets of variables that can be used across multiple pipelines in Azure DevOps. These variables can include secrets, connection strings, and other sensitive information that is needed for builds and releases. Variable Groups provide a centralized way to manage these variables and ensure that they are cons

Securing Azure Services with Fetian FIDO

Hey Folks  Here again with another security topic with Fetian Fido. And once again Fetian devices proved their excellent quality and stability. For this I choose Fetian K33 -  AllinPass FIDO Security Key – FEITIAN ( and  K39 -  Single-button FIDO Security Keys | FEITIAN ( Use case  In an organization following changes needs to be implemented.  1. Update the password policy 2. Update the user session time out to 30 minutes Once these changes being implemented, the following issues need to be addressed 1. Users' complaint new passwords need to be so long 2. Users complain sessions time out makes them work so much slower with the longer passwords 3. Etc... Solution  One of my friends reached out to me to help solve this problem. All I could think of was using passwordless auth with FIDO devices. We have decided to use Fido2 keys for better security and flexibility for the users. The FIDO (Fast IDentity Online) Alliance helps to promote open authentication stand