I have been using Microsoft’s Cloud infrastructure (aka Azure) for a while now by using a monthly free credit that expires every month-end.. That credit being not very big, you have to be very careful about the resource usage, otherwise it’s going to burn thru you small ca$h in no time and suspend your account..
I use the Azure platform because it’s convenient, it can be accessed from everywhere pretty much, and I can even manage my systems from my iPhone with Microsoft’s Azure management tool. You can then launch the RDP (Remote Desktop Protocol) app straight out from the Azure app and open your Virtual Machine desktop on the phone.. Granted, it’s not the most handy way to navigate around, even in zoom mode, but it works. If you own an iPad or a small 7 or 8″ Android Tablet, it works nicely too.
Now my grip (and the purpose of this blog post) has been the VM machine that I had used for the past 2-3 years now and had become so much cluttered that at some point I wanted to start from scratch. When I created my first VM I didn’t wanted to re-invent the wheel (who wants ?), so I selected an image from the Azure Marketplace, which acts like a store with pre-loaded OS images and other kind of platforms (not just Microsoft stuff).

The Azure Marketplace
At the time, there were a few images put up by the Dynamics GP development team that would be based on GP 2013R2 or 2015R2… The image would be completely pre-configured with SQL server, Dexterity, Visual Studio, in short all the tools you needed to start demo or develop for GP. The problem is that those images are no longer to be find in the Market Place (store) of Azure thru the regular GUI (Azure Portal), the only one available being NAV 2017

In desperation I looked if there was another way to reach out to those images. Turns out that Azure has its own command line interface (CLI) which you can call up and use PowerShell (PS) or CLI based commands to manage Azure. So I started to look for the PS commands to access the Market Place and found several Dynamics GP based images listed, nothing recent though, but still better than starting from scratch.
However, my attempts to build a new VM based on any one of those images kept failing in PS, so I ended up posting a support request to the Azure support team (see the discussion here http://bit.ly/2AvCovw ). After a few hours someone from Microsoft responded that they had tried to reproduce the same code and where facing the same issue, though everything in the syntax was looking good. After a few day I got a confirmation that those images where effectively no longer available, but where still showing up in the Market Place catalogue, which would lead to some confusion by anyone that wanted to use them. Azure support responded also that they are going to make sure they get removed from the Market Place as they have no control over the images itself.
Now, back to the title of the post.. How can I manage my own collection of Azure VM’s, since I didn’t wanted to re-invent the wheel every time ? After several hours of reading, poking, searching and trial&error with Azure, I had rendered my only VM completely unusable, because of poor instructions from Microsoft’s Azure Doc page samples.. I found out that I wasn’t the first one dealing with the problem and sitting there with a scrapped VM due to poor instructions.. https://github.com/azure/azure-powershell/issues/1978
Everything you do with the PowerShell command line comes with a certain degree of risk, as there are less safeguards then in the portal itself (with the GUI). After I was able to rescue at least my main drive (OS Disk) which contained all the apps & my databases by taking a snapshot, I managed to create a clone of this snapshot and re-attach to a new freshly created VM.. For the curious out there, here is how it works.
Create a new disk image based on a snapshot
In the Azure Portal, start with the Disk management pane and click on the “+Add” button to create a new managed disk. Give a name to your new OS drive by choosing a meaningful name that you would be able to relate easily to the future VM. Scroll down the page and under the account type make sure to select “Standard HDD” and not one of the Premium or Standard SSD drives, as they cost a fortune to operate, without much performance gain for such a setup (it’s a demo, so who cares after all ? and let me tell you that it’s speedy enough to not suffer from any major latency, as there are other considerations that come into play too). The “Source Type” would be Snapshot and below you would select the file image that were able to take from your other VM that is no longer able to start.
Once you’re done with your selection, at the bottom you just click on ‘Create’ and Azure will create for you a brand new managed disk. When the operation is completed, just hit the refresh button on the menu bar and your new disk should show up. Select that new disk and on the right side, click on “+ Create VM”.
When you start entering the Basics information in the 1st tab for your new VM, don’t forget to select the sizing of your VM, as this pretty much defines how much you’re going to pay to run the machine (and by essence how powerful it is going to be, or not)
I usually go with BxMS VM size, as those are resource templates that are suited for ‘on-demand’ operations, meaning they do not run 100% of their dime in full steam mode, but only when CPU is required.. this allow to offer those machines for a decent pricing and keeps your cost low, still offering some good power when needed to run your demo GP environment.
The other Tabs in the VM creation process can be quickly be jumped by just clicking next, next, next up to the last Tab in which you should see a final validation with a green check-mark that everything looks fine.. At the bottom just click on Create, and Azure will perform all the steps to load up the resources for your newly created VM. The new VM will also be started automatically, and after a few minutes you should be able to see it in the “Virtual Machine” section of your Dasboard.
Identity of your new server
Now in the this whole process, there is one important point that was omitted, and the reason is that you’re taking a cloned disk from an existing snapshot of a running VM.. which means 2 things :
1. The newly created VM will have the same name & identity as your old VM
2. The login credentials are exactly the same as the other VM too
This wouldn’t be so much of an issue if your various VM’s are all running in an isolated and dedicated network, but in order to avoid a sprawl of resources in your Azure account, and to keep things simple, I usually create all my VM’s in the same Resource Group, which means they are most likely to share also the same virtual network and be in the same subnet, so there is a risk of potential name conflicts.
In order to fix this, you’ll have to go into the computer’s properties after the first login, and change the computer name. This will trigger a request for reboot of the VM, which you should follow. After the reboot of the VM and another login, you’ll have to also rename the SQL server instance, as it is based on the same image too. Here is a brief script to check the current server instance name and how to rename it :
/* Use the script below to determine the name of your server and instance
(c) B. Bucher / 2010-08-17 (see KB303774 or Q303774)
see also : http://msdn.microsoft.com/en-us/library/aa197071(SQL.80).aspx
and http://www.sqlservercentral.com/Forums/Topic162137-5-1.aspx
Warning : SQL Service needs to be restarted after the rename !
*/
-- get current SQL Server name\instance name
SELECT @@SERVERNAME as ServerName
-- get current machine name and instance name
SELECT SERVERPROPERTY('MachineName') as MachineName,
SERVERPROPERTY ('InstanceName') as InstanceName
-- uncomment below the lines to rename the server and instance
sp_dropserver 'DynGP2013R2' --> enter the old name
go
sp_addserver 'DynGP2015R2', 'local' --> enter the new name
go
After the SQL instance has been renamed, you have to restart the SQL Services in order for the changes to take effect. Oh, and don’t forget that little hidden entry that is called ODBC :-).. If you don’t changed the SQL server name, your GP client will never be able to connect and just time out.
From here on, regular tasks & operations around Azure can be performed with your VM’s and I stongly suggest also to add to each of your newly created VM an automation process to shut them down by the end of the day when you don’t use them.. Starting the VM doesn’t take long, but powering them off saves you a lot idle running machines, which is charged by the use time on Azure.. The more $$ you keep in your credit, the more often you can run multiple machines at the same time. Such a configuration would typically go thru a month with a credit of less than 100$US. If you let your VM’s run 24/7, chances are that your credit is down to zero by the midst of the billing period..
Good luck and until next post
@GP_Beat
Leave a Reply