If you write code to SQL Server then you might be interested in this: at the end of 2017 I wrote a tSQLt tdd training course which has helped over 300 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. The course is free if you are happy to wait 10 weeks to complete it, with 1 lesson being made available per week - if you are in more of a hurry or you would like to help support the project you can purchase the course which makes it instantly available to you.

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 .