Create an azure VM from an image using availability zones and templates - azure

I am currently deploying some new azure VMs using a template. This template contains a link to a VHD image and uses availability sets.
After having a look at the azure docs, I cannot seem to tell or find out if it's possible to use my current procedure to deploy the VM in a specific zone.
I changed my template to use zones rather than sets but when I use it in Azure CLI I have this error message returned:
"Virtual Machines deployed to an Availability Zone must use managed disks."
I then tried to add the managed disk section to the template without success.
Below there is the pseudocode of the template related to the storage of the VM:
"storageProfile": {
"osDisk": {
"managedDisk": {
"storageAccountType": "StandardSSD_LRS"
},
"osType": "Linux",
"name": "myName.vhd",
"createOption": "FromImage",
"image": {
"uri": "myUri.vhd"
},
"vhd": {
"uri": "myVhdImageUri.vhd"
},
"caching": "ReadWrite"
}
}

You have to convert disk to managed disk first. Then you will be able to use it in your template.

Related

Azure VM image does not have Source Blob URI

After following the instructions for creating a managed image in Azure, I'm trying to create a VM from the managed image inside the ARM template. The ARM template requires a source blob URI which should be listed on the VM image page within the Azure portal, but it's blank (see screen shot below).
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource
Did I miss a step somewhere?
yes, to create a vm from the managed disk image you need its resource id, not its uri (because it doesnt have one). Here's an ARM Template bit to create a VM from the managed disk image:
"storageProfile": {
"imageReference": {
"id": "[resourceId('Microsoft.Compute/images', concat(parameters('vmPrefix'), '-gateway-osImage'))]"
},
"osDisk": {
"name": "[concat(parameters('vmPrefix'), '-gateway-os-vhd')]",
"createOption": "FromImage"
}
},

Rename Azure Managed Disk

We are using Azure SQL template to deploy VMs with managed disks instead of storage blobs. Unfortunately, the auto generated managed disk names are not desired and we cannot find a way to change them in the deployment template.
Is there a way to rename a managed disk post deployment? (or during)
Well, it is super easy to give them names. there's a name property for that...
"storageProfile": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-Datacenter",
"version": "latest"
},
"osDisk": {
"createOption": "FromImage",
"name": "somename" <<< THIS IS IT
}
},
I'm not sure that its possible to rename after you've created the disk. might be possible if you create a managed disk out of managed disk and you would be able to supply the name for the new one.

Premium (SSD) managed disks for Azure VM Scale Set

I've been trying to get Premium managed disks (SSD) enabled for Azure Virtual Machine Scale Sets, but I don't seem to get it setup.
Standard (HHD) seems to work for managed disks.
Anybody got this working?
Just pick SSD capable VM's when creating the VMSS.
The VMSS portal page would say that its still using HDD, but if you check the actual resource properties it would say:
"storageProfile": {
"osDisk": {
"createOption": "FromImage",
"caching": "ReadWrite",
"managedDisk": {
"storageAccountType": "Premium_LRS"
}
},
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-Datacenter",
"version": "latest"
}
},

Set up Azure Service Fabric cluster on managed disks

Does anybody know how to set up Service Fabric cluster with VMs on managed disks(both OS and Data)? I would be very interested to know how to do this using template config.
You need to change VMSS api version to 2016-04-30-preview and storageProfile to this:
"storageProfile": {
"imageReference": {
"publisher": "[parameters('vmImagePublisher')]",
"offer": "[parameters('vmImageOffer')]",
"sku": "[parameters('vmImageSku')]",
"version": "[parameters('vmImageVersion')]"
},
"osDisk": {
"createOption": "FromImage"
"managedDisk": {
"storageAccountType": "Standard_LRS"
# defauls to Standard_LRS,
# you can choose to pick Premium_LRS if your VM size supports premium storage
# or you can omit this node completely if you need standard storage
}
}
}
Storage Accounts are redundant when using managed disks (you don't need them, Azure handles that for you).

Since it's not possible to create Blob container in Azure ARM, then how can I enable Archive using ARM?

According to the documentation I can enable the Azure Event Hubs Archive feature using an Azure Resource Manager template. The template takes a blobContainerName argument:
"The blob container where you want your event data be archived."
But afaik it's not possible to create a blob container using an ARM template, then how am I supposed to enable the Archive feature on an Event Hub?
The purpose of the ARM template is to provision everything from scratch, not to manually create some of the resources using the portal.
It wasn't possible before to create containers in your storage account, but this has been changed. New functionality has been added to the ARM template for Storage Accounts which enable you to create containers.
To create a storage account with a container called theNameOfMyContainer, add this to your resources block of the ARM template.
{
"name": "[parameters('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2018-02-01",
"location": "[resourceGroup().location]",
"kind": "StorageV2",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"accessTier": "Hot"
},
"resources": [{
"name": "[concat('default/', 'theNameOfMyContainer')]",
"type": "blobServices/containers",
"apiVersion": "2018-03-01-preview",
"dependsOn": [
"[parameters('storageAccountName')]"
],
"properties": {
"publicAccess": "Blob"
}
}]
}
To my knowledge, you can use None, Blob or Container for your publicAccess.
It's still not possible to create Queues and Tables, but hopefull this will be added soon.
Just like you said, there is no way to create a blob in Azure ARM Template, so the only logical answer to this question is: supply existing blob at deployment time. One way to do that would be to create a blob with powershell and pass it as a parameter to ARM Deployment.

Resources