Redeploy Azure Windows VM

By:   |   Comments   |   Related: > Azure


Problem

I see that I have constant issues with my Azure Windows based SQL Virtual Machine (VM). I am not able to start my Azure SQL VM or RDP to it. Is there any way I can redeploy the Azure VM and check if the issue gets resolved? Will there be any kind of data loss when we redeploy?

Solution

This tip assumes that you already have resources in your Azure environment and you are familiar with using the Azure portal. If you are new to Azure, you can subscribe to a trial account here, which will give you access to Azure services for a year and a credit of USD $200. You can refer to this link which provides a detailed step by step instructions for creating a windows based Azure VM. The steps are straight forward and you can get a SQL Server Azure VM running in a few minutes.

Screenshot of a test Azure VM taken before redeployment

As shown in the screenshot below, there is a test database already created on the Azure SQL VM as part of this demo. This is to check if this database exists after the VM is re-deployed.

database list

Issues with deployed VM

After deploying the Azure VM, you realize that there are constant issues and you decide to redeploy the virtual machine. The redeploy option is on the left-hand side of the Azure blade as shown on the portal.

azure vm redeploy

Also, make note of the public IP address and location. We can validate after the VM is redeployed.

Redeploy the Azure VM

Once you click on the redeploy option, you will get this validation screen asking for confirmation.

vm redeploy

From the displayed message, you know that the redeploy option is an offline operation. So, use this option with care only after you have exhausted all the troubleshooting options. There is also this other message about loss of data on the temporary drive (D). In any case, you shouldn't be storing any data that you will need on this temporary D drive.

Redeploying operation

Once you click on the Redeploy option, you will see that the current virtual machine gets shut down and you can see the progress of the redeploy operation under the notifications section.

status of vm redeploy

After a few minutes, try to refresh the status of the virtual machine on the left-hand side Overview option, you will see that the status of the virtual machine changes to 'Starting' as shown.

status of vm redeploy

In a few minutes, while you refresh the 'Overview' option again, you will see that the status of the VM changes to 'Running'.

status of vm redeploy

At this point, you can also see the alert on the notification section, which will confirm that the redeployment option has succeeded. You would be a in position to connect to the virtual machine at this point.

vm redploy notification

Overall, you will notice that the redeployment operation is a one step process where you just need to confirm once and then process completes seamlessly in a few minutes.

Validation checks after the redeploy operation

After the redeployment, you can see that there is no change in the public IP address. Below is a screenshot of the 'Overview' option after redeployment.

vm public ip address

You will notice that the public IP address is unchanged. You will notice that if you had manually stopped and restarted the Azure VM, the public IP address would have changed as you can see from this message when you try the manual option to stop the Azure VM and then start it. Once you restart the Azure VM manually, the public IP address gets reset. Below is the screenshot you will see when you try to stop the Azure VM manually.

vm public ip address

Another check is to ensure that the user databases that you had created earlier exists. This is a screenshot of the SQL instance after the VM was redeployed.

list of databases

As you can see the user databases exists and there is no loss of data apart from anything that was stored on the temporary D drive.

Data loss warning (Temporary D drive)

As you can see from the read me file that is present on the temporary D drive, it warns clearly of data loss and recommends not to store anything important on that drive as it is not recoverable. You can see a screenshot of the read me file below.

error message data loss

In this demo, you saw how easily we can redeploy an Azure VM by clicking on the 'Redeploy' option that is available and the process completes quickly without any user intervention.

Next Steps
  • In this tip, you saw a reference to a tip to create a new Azure windows SQL VM
  • In the demo, you saw the things you can test before and after performing the redeploy operation
  • In the demo, you saw how easily we can redeploy an Azure VM if there are issues
  • In the demo, you saw how the status of the Azure VM changes during the redeploy operation
  • From this tip, you know that there are no issues with user databases after the redeploy operation
  • From this tip, you know that the data in the temporary storage (D drive) gets deleted after the redeploy operation
  • Try out this demo on your own Azure environment
  • Refer to other articles available on MSSQLTips related to Azure


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Mohammed Moinudheen Mohammed Moinudheen is a SQL Server DBA with over 6 years experience managing production databases for a few Fortune 500 companies.

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips



Comments For This Article

















get free sql tips
agree to terms