If you write code to SQL Server then you might be interested in this: I have written a tSQLt tdd training course which has helped over 500 people learn both tSQLt and how to apply TDD practices to their SQL Server T-SQL development, you can join the course at https://courses.agilesql.club.

Interesting Azure ARM "Make it So" behaviour

I had a template that deployed a premium managed disk and a virtual machine. I defined the disk like:

{ "comments": "Managed Disk.", "type": "Microsoft.Compute/disks", "name": "[variables('diskName')]", "apiVersion": "2016-04-30-preview", "location": "[parameters('location')]", "tags": { "displayName": "Data Disk 1 - Presented as LUN 0" }, "properties": { "accountType": "Premium_LRS", "creationData": { "createOption": "Empty" }, "diskSizeGB": 1024 }, "dependsOn": [] },

Then in the same template, I had a virtual machine with the storage section that looked like:

"dataDisks": [ { "lun": 0, "createOption": "Attach", "caching": "ReadWrite", "managedDisk": { "storageAccountType": "Premium_LRS", "id": "[resourceId('Microsoft.Compute/disks', variables('diskName'))]" }, "diskSizeGB": 2048 } ]

the thing to note is that I made a mistake with the storage profile and said that the disk I had already deployed as a separate resource was 2048 GB instead of 1024 GB.

What happened was that the first deployment:

  • Deployed the disk as 1024 GB
  • Resized the disk to 2048 GB when the VM was deployed

When I tried to redeploy the template I got this error message:

Disks or snapshot cannot be resized down.

It took a bit of head scratching to understand where the problem was but eventually, I realised that the size on the vm storage profile was incorrect.

So the Azure “MAKE IT SO” worked perfectly and once I knew that the storage profile on the VM had the option “diskSizeGB” the help for which says “The initial disk size in GB for blank data disks, and the new desired size for resizing existing OS and data disks” everything was a breeze .

Subscribe

* indicates required

Please select all the ways you would like to hear from Agile Sql Club:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.