IaC on Azure - Linux Virtual Machine Deployment in a breeze with ARM Template

2017-03-11-azure-iac-arm-json-template-for-virtual-machine

Previously, I demonstrated on the topic of Windows Server Virtual Machine Deployment made easy with ARM Template, but the use of an ARM Template is just not about deploying Microsoft Windows Server. With Microsoft Azure IaaS today, you can deploy multiple Linux Distros (Eg. CentOS, Ubuntu, Red Hat, SUSE Linux Enterprise or others) that are listed in Linux on Azure-Endorsed Distributions.

 

For today, I will continue the Infrastructure as Code (IaC) concept on how to deploy an Ubuntu Server or Red Hat Enterprise Linux Server with ARM Templates in a breeze.

 

Let us begin with…

 

1. An Ubuntu Server ARM Template
1.1. Copy the JSON code below, paste it into the new ARM Template and save it

 
{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "virtualNetworksName": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name of the virtual network for the virtual machine."
            }
        },
        "virtualNetworkAddressPrefix": {
            "type": "string",
            "defaultValue": null,
            "minLength": 9,
            "maxLength": 18,
            "metadata": {
                "description": "The IP addresses prefixes for the virtual network. (Eg. 10.1.0.0/16 )"
            }
        },
        "virtualNetworkSubnetName": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name of the virtual network subnet. (Eg. Subnet-Dev )"
            }
        },
        "virtualNetworkSubnetAddressPrefix": {
            "type": "string",
            "defaultValue": null,
            "minLength": 9,
            "maxLength": 18,
            "metadata": {
                "description": "The IP addresses prefixes for the virtual network. (Eg. 10.1.1.0/24 )"
            }
        },
        "networkSecurityGroupsName": {
            "type": "string",
            "defaultValue": null,
            "minLength": 9,
            "maxLength": 18,
            "metadata": {
                "description": "The network security group name for the virtual machine public network interface."
            }
        },
        "storageAccountsName": {
            "type": "string",
            "defaultValue": null,
            "minLength": 3,
            "maxLength": 24,
            "metadata": {
                "description": "The name of the storage account for storing the virtual machine."
            }
        },
        "diagnosticStorageAccountsName": {
            "type": "string",
            "defaultValue": null,
            "minLength": 3,
            "maxLength": 24,
            "metadata": {
                "description": "The name of the storage account for storing the virtual machine boot diagnostic."
            }
        },
        "virtualMachineName": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name of the virtual machine."
            }
        },
       "virtualMachineSize": {
           "type": "string",
           "allowedValues": [
               "Standard_A0", "Standard_A1", "Standard_A2", "Standard_A3",
               "Standard_A4", "Standard_A5", "Standard_A6", "Standard_A7",
                
               "Standard_D1_v2", "Standard_D2_v2", "Standard_D3_v2", "Standard_D4_v2",
               "Standard_D5_v2", "Standard_D6_v2", "Standard_D7_v2", "Standard_D8_v2",
               "Standard_D9_v2", "Standard_D10_v2", "Standard_D11_v2", "Standard_D12_v2",
               "Standard_D13_v2", "Standard_D14_v2", "Standard_D15_v2",
 
               "Standard_F1", "Standard_F2", "Standard_F4", "Standard_F8", "Standard_F16"
           ],
           "defaultValue": "Standard_A0",
           "metadata": {
               "description": "The size of the virtual machine."
           }
       },
       "virtualMachineDataDiskSize": {
            "type": "int",
            "defaultValue": 40,
            "minValue": 10,
            "maxValue": 1023,
            "metadata": {
                "description": "The GB size of the data disk for the virtual machine."
            }
       },
       "virtualMachineSKU":{
           "type": "string",
           "allowedValues": [
                "12.04.2-LTS", "12.04.3-LTS", "12.04.4-LTS", "12.04.5-DAILY-LTS", "12.04.5-LTS", 
                "12.10",
                
                "14.04-beta", "14.04.0-LTS", "14.04.1-LTS", "14.04.2-LTS", "14.04.3-LTS", 
                "14.04.4-LTS", "14.04.5-DAILY-LTS", "14.04.5-LTS", "14.10", "14.10-beta", 
                "14.10-DAILY",
                
                "16.04-alpha", "16.04-beta", "16.04-DAILY-LTS", "16.04-LTS", "16.04.0-LTS", 
                "16.10", "16.10-DAILY",
                
                "17.04", "17.04-DAILY", "17.10-DAILY"
           ],
           "defaultValue": "16.04-LTS",
           "metadata": {
               "description": "The SKU of the Ubuntu Server virtual machine."
           }
       },
        "virtualMachineNetworkInterfacesName": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name of the network interface for the virtual machine."
            }
        },
        "virtualMachinePublicIPAddressesName": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name of the public IP addresses for the virtual machine."
            }
        },
        "virtualMachineAdminUsername": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The administrator username for the virtual machine."
            }
        },
        "virtualMachineAdminPassword": {
            "type": "securestring",
            "defaultValue": null,
            "metadata": {
                "description": "The administrator password for the virtual machine."
            }
        },
        "resourceOwnerNameTag": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name of the resource owner for the Owner Name tag."
            }
        },
        "businessUnitTag": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name of the department for the Business Unit tag."
            }
        },
        "costCenterTag": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "A cost identifier for the Cost Center tag."
            }
        },
        "environmentTag": {
            "allowedValues": [
                null,
                "Development",
                "Staging",
                "Production"
            ],
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name for the Environment tag."
            }
        },
        "maintenanceWindowStartTag": {
            "allowedValues": [
                null,
                "Mon 00:00", "Mon 01:00", "Mon 02:00", "Mon 03:00", "Mon 04:00", "Mon 05:00", 
                "Mon 06:00", "Mon 07:00", "Mon 08:00", "Mon 09:00", "Mon 10:00", "Mon 11:00", 
                "Mon 12:00", "Mon 13:00", "Mon 14:00", "Mon 15:00", "Mon 16:00", "Mon 17:00", 
                "Mon 18:00", "Mon 19:00", "Mon 20:00", "Mon 21:00", "Mon 22:00", "Mon 23:00",
                "Tue 00:00", "Tue 01:00", "Tue 02:00", "Tue 03:00", "Tue 04:00", "Tue 05:00",
                "Tue 06:00", "Tue 07:00", "Tue 08:00", "Tue 09:00", "Tue 10:00", "Tue 11:00",
                "Tue 12:00", "Tue 13:00", "Tue 14:00", "Tue 15:00", "Tue 16:00", "Tue 17:00",
                "Tue 18:00", "Tue 19:00", "Tue 20:00", "Tue 21:00", "Tue 22:00", "Tue 23:00",
                "Wed 00:00", "Wed 01:00", "Wed 02:00", "Wed 03:00", "Wed 04:00", "Wed 05:00",
                "Wed 06:00", "Wed 07:00", "Wed 08:00", "Wed 09:00", "Wed 10:00", "Wed 11:00",
                "Wed 12:00", "Wed 13:00", "Wed 14:00", "Wed 15:00", "Wed 16:00", "Wed 17:00",
                "Wed 18:00", "Wed 19:00", "Wed 20:00", "Wed 21:00", "Wed 22:00", "Wed 23:00",
                "Thu 00:00", "Thu 01:00", "Thu 02:00", "Thu 03:00", "Thu 04:00", "Thu 05:00",
                "Thu 06:00", "Thu 07:00", "Thu 08:00", "Thu 09:00", "Thu 10:00", "Thu 11:00",
                "Thu 12:00", "Thu 13:00", "Thu 14:00", "Thu 15:00", "Thu 16:00", "Thu 17:00",
                "Thu 18:00", "Thu 19:00", "Thu 20:00", "Thu 21:00", "Thu 22:00", "Thu 23:00",
                "Fri 00:00", "Fri 01:00", "Fri 02:00", "Fri 03:00", "Fri 04:00", "Fri 05:00",
                "Fri 06:00", "Fri 07:00", "Fri 08:00", "Fri 09:00", "Fri 10:00", "Fri 11:00",
                "Fri 12:00", "Fri 13:00", "Fri 14:00", "Fri 15:00", "Fri 16:00", "Fri 17:00",
                "Fri 18:00", "Fri 19:00", "Fri 20:00", "Fri 21:00", "Fri 22:00", "Fri 23:00",
                "Sat 00:00", "Sat 01:00", "Sat 02:00", "Sat 03:00", "Sat 04:00", "Sat 05:00",
                "Sat 06:00", "Sat 07:00", "Sat 08:00", "Sat 09:00", "Sat 10:00", "Sat 11:00",
                "Sat 12:00", "Sat 13:00", "Sat 14:00", "Sat 15:00", "Sat 16:00", "Sat 17:00",
                "Sat 18:00", "Sat 19:00", "Sat 20:00", "Sat 21:00", "Sat 22:00", "Sat 23:00",
                "Sun 00:00", "Sun 01:00", "Sun 02:00", "Sun 03:00", "Sun 04:00", "Sun 05:00",
                "Sun 06:00", "Sun 07:00", "Sun 08:00", "Sun 09:00", "Sun 10:00", "Sun 11:00",
                "Sun 12:00", "Sun 13:00", "Sun 14:00", "Sun 15:00", "Sun 16:00", "Sun 17:00",
                "Sun 18:00", "Sun 19:00", "Sun 20:00", "Sun 21:00", "Sun 22:00", "Sun 23:00"
            ],
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The start of the maintenance (Mon, Tue, Wed, Thu, Fri, Sat or Sun HH:mm) schedule of the resource for Maintenance Window Start tag."
            }
        },
        "maintenanceWindowEndTag": {
            "allowedValues": [
                null,
                "Mon 00:00", "Mon 01:00", "Mon 02:00", "Mon 03:00", "Mon 04:00", "Mon 05:00", 
                "Mon 06:00", "Mon 07:00", "Mon 08:00", "Mon 09:00", "Mon 10:00", "Mon 11:00", 
                "Mon 12:00", "Mon 13:00", "Mon 14:00", "Mon 15:00", "Mon 16:00", "Mon 17:00", 
                "Mon 18:00", "Mon 19:00", "Mon 20:00", "Mon 21:00", "Mon 22:00", "Mon 23:00",
                "Tue 00:00", "Tue 01:00", "Tue 02:00", "Tue 03:00", "Tue 04:00", "Tue 05:00",
                "Tue 06:00", "Tue 07:00", "Tue 08:00", "Tue 09:00", "Tue 10:00", "Tue 11:00",
                "Tue 12:00", "Tue 13:00", "Tue 14:00", "Tue 15:00", "Tue 16:00", "Tue 17:00",
                "Tue 18:00", "Tue 19:00", "Tue 20:00", "Tue 21:00", "Tue 22:00", "Tue 23:00",
                "Wed 00:00", "Wed 01:00", "Wed 02:00", "Wed 03:00", "Wed 04:00", "Wed 05:00",
                "Wed 06:00", "Wed 07:00", "Wed 08:00", "Wed 09:00", "Wed 10:00", "Wed 11:00",
                "Wed 12:00", "Wed 13:00", "Wed 14:00", "Wed 15:00", "Wed 16:00", "Wed 17:00",
                "Wed 18:00", "Wed 19:00", "Wed 20:00", "Wed 21:00", "Wed 22:00", "Wed 23:00",
                "Thu 00:00", "Thu 01:00", "Thu 02:00", "Thu 03:00", "Thu 04:00", "Thu 05:00",
                "Thu 06:00", "Thu 07:00", "Thu 08:00", "Thu 09:00", "Thu 10:00", "Thu 11:00",
                "Thu 12:00", "Thu 13:00", "Thu 14:00", "Thu 15:00", "Thu 16:00", "Thu 17:00",
                "Thu 18:00", "Thu 19:00", "Thu 20:00", "Thu 21:00", "Thu 22:00", "Thu 23:00",
                "Fri 00:00", "Fri 01:00", "Fri 02:00", "Fri 03:00", "Fri 04:00", "Fri 05:00",
                "Fri 06:00", "Fri 07:00", "Fri 08:00", "Fri 09:00", "Fri 10:00", "Fri 11:00",
                "Fri 12:00", "Fri 13:00", "Fri 14:00", "Fri 15:00", "Fri 16:00", "Fri 17:00",
                "Fri 18:00", "Fri 19:00", "Fri 20:00", "Fri 21:00", "Fri 22:00", "Fri 23:00",
                "Sat 00:00", "Sat 01:00", "Sat 02:00", "Sat 03:00", "Sat 04:00", "Sat 05:00",
                "Sat 06:00", "Sat 07:00", "Sat 08:00", "Sat 09:00", "Sat 10:00", "Sat 11:00",
                "Sat 12:00", "Sat 13:00", "Sat 14:00", "Sat 15:00", "Sat 16:00", "Sat 17:00",
                "Sat 18:00", "Sat 19:00", "Sat 20:00", "Sat 21:00", "Sat 22:00", "Sat 23:00",
                "Sun 00:00", "Sun 01:00", "Sun 02:00", "Sun 03:00", "Sun 04:00", "Sun 05:00",
                "Sun 06:00", "Sun 07:00", "Sun 08:00", "Sun 09:00", "Sun 10:00", "Sun 11:00",
                "Sun 12:00", "Sun 13:00", "Sun 14:00", "Sun 15:00", "Sun 16:00", "Sun 17:00",
                "Sun 18:00", "Sun 19:00", "Sun 20:00", "Sun 21:00", "Sun 22:00", "Sun 23:00"
            ],
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The end of the maintenance (Mon, Tue, Wed, Thu, Fri, Sat or Sun HH:mm) schedule of the resource for Maintenance Window End tag."
            }
        },
        "expirationDateTag": {
            "type": "string",
            "defaultValue": "yyyy-MM-dd HH:mm:ss",
            "metadata": {
                "description": "The expiration (yyyy-MM-dd HH:mm:ss) schedule of the resource for Expiration Date tag."
            }
        }
    },
    "variables": {},
    "resources": [
        {
            "comments": "Creates the virtual machine.",
            "type": "Microsoft.Compute/virtualMachines",
            "name": "[parameters('virtualMachineName')]",
            "apiVersion": "2015-06-15",
            "location": "[resourceGroup().location]",
            "tags": {
                "ResourceOwner": "[parameters('resourceOwnerNameTag')]",
                "BusinessUnit": "[parameters('businessUnitTag')]",
                "CostCenter": "[parameters('costCenterTag')]",
                "Environment": "[parameters('environmentTag')]",
                "MaintenanceWindowStart": "[parameters('maintenanceWindowStartTag')]",
                "MaintenanceWindowEnd": "[parameters('maintenanceWindowEndTag')]",
                "ExpirationDate": "[parameters('expirationDateTag')]"
            },
            "properties": {
                "hardwareProfile": {
                    "vmSize": "[parameters('virtualMachineSize')]"
                },
                "storageProfile": {
                    "imageReference": {
                        "publisher": "Canonical",
                        "offer": "UbuntuServer",
                        "sku": "[parameters('virtualMachineSKU')]",
                        "version": "latest"
                    },
                    "osDisk": {
                        "name": "[parameters('virtualMachineName')]",
                        "createOption": "FromImage",
                        "vhd": {
                            "uri": "[concat('https', '://', parameters('storageAccountsName'), '.blob.core.windows.net', concat('/vhds/', parameters('virtualMachineName'),'_OperatingSystem.vhd'))]"
                        },
                        "caching": "ReadWrite"
                    },
                    "dataDisks": [
                         {
                            "name": "Data",
                            "diskSizeGB": "[parameters('virtualMachineDataDiskSize')]",
                            "lun": 0,
                            "vhd": {
                                "uri": "[concat('https', '://', parameters('storageAccountsName'), '.blob.core.windows.net', concat('/vhds/', parameters('virtualMachineName'),'_Data.vhd'))]"
                            },  
                            "createOption": "Empty"
                        }
                    ]
                },
                "osProfile": {
                    "computerName": "[parameters('virtualMachineName')]",
                    "adminUsername": "[parameters('virtualMachineAdminUsername')]",
                    "linuxConfiguration": {
                        "disablePasswordAuthentication": false
                    },
                    "secrets": [],
                    "adminPassword": "[parameters('virtualMachineAdminPassword')]"
                },
                "networkProfile": {
                    "networkInterfaces": [
                        {
                            "id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('virtualMachineNetworkInterfacesName'))]"
                        }
                    ]
                }
            },
            "resources": [],
            "dependsOn": [
                "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountsName'))]",
                "[resourceId('Microsoft.Network/networkInterfaces', parameters('virtualMachineNetworkInterfacesName'))]"
            ]
        },
        {
            "comments": "Creates the network interfaces for the virtual machine.",
            "type": "Microsoft.Network/networkInterfaces",
            "name": "[parameters('virtualMachineNetworkInterfacesName')]",
            "apiVersion": "2016-03-30",
            "location": "[resourceGroup().location]",
            "tags": {
                "ResourceOwner": "[parameters('resourceOwnerNameTag')]",
                "BusinessUnit": "[parameters('businessUnitTag')]",
                "CostCenter": "[parameters('costCenterTag')]",
                "Environment": "[parameters('environmentTag')]",
                "MaintenanceWindowStart": "[parameters('maintenanceWindowStartTag')]",
                "MaintenanceWindowEnd": "[parameters('maintenanceWindowEndTag')]",
                "ExpirationDate": "[parameters('expirationDateTag')]"
            },
            "properties": {
                "ipConfigurations": [
                    {
                        "name": "ipconfig1",
                        "properties": {
                            "privateIPAddress": "10.0.0.4",
                            "privateIPAllocationMethod": "Dynamic",
                            "publicIPAddress": {
                                "id": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('virtualMachinePublicIPAddressesName'))]"
                            },
                            "subnet": {
                                "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworksName')), '/subnets/', parameters('virtualNetworkSubnetName'))]"
                            }
                        }
                    }
                ],
                "dnsSettings": {
                    "dnsServers": []
                },
                "enableIPForwarding": false,
                "networkSecurityGroup": {
                    "id": "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupsName'))]"
                }
            },
            "resources": [],
            "dependsOn": [
                "[resourceId('Microsoft.Network/publicIPAddresses', parameters('virtualMachinePublicIPAddressesName'))]",
                "[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworksName'))]",
                "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupsName'))]"
            ]
        },
        {
            "comments": "Create a network security group for the virtual machine public network interface.",
            "type": "Microsoft.Network/networkSecurityGroups",
            "name": "[parameters('networkSecurityGroupsName')]",
            "apiVersion": "2016-03-30",
            "location": "[resourceGroup().location]",
            "tags": {
                "ResourceOwner": "[parameters('resourceOwnerNameTag')]",
                "BusinessUnit": "[parameters('businessUnitTag')]",
                "CostCenter": "[parameters('costCenterTag')]",
                "Environment": "[parameters('environmentTag')]",
                "MaintenanceWindowStart": "[parameters('maintenanceWindowStartTag')]",
                "MaintenanceWindowEnd": "[parameters('maintenanceWindowEndTag')]",
                "ExpirationDate": "[parameters('expirationDateTag')]"
            },
            "properties": {
                "securityRules": [
                    {
                        "name": "default-allow-ssh",
                        "properties": {
                            "protocol": "Tcp",
                            "sourcePortRange": "*",
                            "destinationPortRange": "22",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 1000,
                            "direction": "Inbound"
                        }
                    }
                ]
            },
            "resources": [],
            "dependsOn": []
        },
        {
            "comments": "Creates the public IP addresses for the virtual machine.",
            "type": "Microsoft.Network/publicIPAddresses",
            "name": "[parameters('virtualMachinePublicIPAddressesName')]",
            "apiVersion": "2016-03-30",
            "location": "[resourceGroup().location]",
            "tags": {
                "ResourceOwner": "[parameters('resourceOwnerNameTag')]",
                "BusinessUnit": "[parameters('businessUnitTag')]",
                "CostCenter": "[parameters('costCenterTag')]",
                "Environment": "[parameters('environmentTag')]",
                "MaintenanceWindowStart": "[parameters('maintenanceWindowStartTag')]",
                "MaintenanceWindowEnd": "[parameters('maintenanceWindowEndTag')]",
                "ExpirationDate": "[parameters('expirationDateTag')]"
            },
            "properties": {
                "publicIPAllocationMethod": "Dynamic",
                "idleTimeoutInMinutes": 4
            },
            "resources": [],
            "dependsOn": []
        },
        {
            "comments": "Creates the virtual networks for the environment.",
            "type": "Microsoft.Network/virtualNetworks",
            "name": "[parameters('virtualNetworksName')]",
            "apiVersion": "2016-03-30",
            "location": "[resourceGroup().location]",
            "tags": {
                "ResourceOwner": "[parameters('resourceOwnerNameTag')]",
                "BusinessUnit": "[parameters('businessUnitTag')]",
                "CostCenter": "[parameters('costCenterTag')]",
                "Environment": "[parameters('environmentTag')]",
                "MaintenanceWindowStart": "[parameters('maintenanceWindowStartTag')]",
                "MaintenanceWindowEnd": "[parameters('maintenanceWindowEndTag')]",
                "ExpirationDate": "[parameters('expirationDateTag')]"
            },
            "properties": {
                "addressSpace": {
                    "addressPrefixes": [
                        "[parameters('virtualNetworkAddressPrefix')]"
                    ]
                },
                "subnets": [
                    {
                        "name": "[parameters('virtualNetworkSubnetName')]",
                        "properties": {
                            "addressPrefix": "[parameters('virtualNetworkSubnetAddressPrefix')]"
                        }
                    }
                ]
            },
            "resources": [],
            "dependsOn": []
        },
        {
            "comments": "Creates the disgnostic storage account to store the virtual machine boot diagnostic.",
            "type": "Microsoft.Storage/storageAccounts",
            "sku": {
                "name": "Standard_LRS",
                "tier": "Standard"
            },
            "kind": "Storage",
            "name": "[parameters('diagnosticStorageAccountsName')]",
            "apiVersion": "2016-01-01",
            "location": "[resourceGroup().location]",
            "tags": {
                "ResourceOwner": "[parameters('resourceOwnerNameTag')]",
                "BusinessUnit": "[parameters('businessUnitTag')]",
                "CostCenter": "[parameters('costCenterTag')]",
                "Environment": "[parameters('environmentTag')]",
                "MaintenanceWindowStart": "[parameters('maintenanceWindowStartTag')]",
                "MaintenanceWindowEnd": "[parameters('maintenanceWindowEndTag')]",
                "ExpirationDate": "[parameters('expirationDateTag')]"
            },
            "properties": {},
            "resources": [],
            "dependsOn": []
        },
        {
            "comments": "Creates the storage account to store the virtual machine.",
            "type": "Microsoft.Storage/storageAccounts",
            "sku": {
                "name": "Standard_LRS",
                "tier": "Standard"
            },
            "kind": "Storage",
            "name": "[parameters('storageAccountsName')]",
            "apiVersion": "2016-01-01",
            "location": "[resourceGroup().location]",
            "tags": {
                "ResourceOwner": "[parameters('resourceOwnerNameTag')]",
                "BusinessUnit": "[parameters('businessUnitTag')]",
                "CostCenter": "[parameters('costCenterTag')]",
                "Environment": "[parameters('environmentTag')]",
                "MaintenanceWindowStart": "[parameters('maintenanceWindowStartTag')]",
                "MaintenanceWindowEnd": "[parameters('maintenanceWindowEndTag')]",
                "ExpirationDate": "[parameters('expirationDateTag')]"
            },
            "properties": {},
            "resources": [],
            "dependsOn": []
        }
    ]
}

1.2. Select Deploy on the Template that you have just created in Azure Templates with the copied JSON code and fill up the form during provisioning

2017-03-11-azure-iac-arm-1-templates-deploy-ubuntu-server-virtual-machine-on-independent-virtual-network-subnet

 

2. A Red Hat Enterprise Linux Server ARM Template
2.1. Copy the JSON code below, paste it into the new ARM Template and save it

 
{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "virtualNetworksName": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name of the virtual network for the virtual machine."
            }
        },
        "virtualNetworkAddressPrefix": {
            "type": "string",
            "defaultValue": null,
            "minLength": 9,
            "maxLength": 18,
            "metadata": {
                "description": "The IP addresses prefixes for the virtual network. (Eg. 10.1.0.0/16 )"
            }
        },
        "virtualNetworkSubnetName": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name of the virtual network subnet. (Eg. Subnet-Dev )"
            }
        },
        "virtualNetworkSubnetAddressPrefix": {
            "type": "string",
            "defaultValue": null,
            "minLength": 9,
            "maxLength": 18,
            "metadata": {
                "description": "The IP addresses prefixes for the virtual network. (Eg. 10.1.1.0/24 )"
            }
        },
        "networkSecurityGroupsName": {
            "type": "string",
            "defaultValue": null,
            "minLength": 9,
            "maxLength": 18,
            "metadata": {
                "description": "The network security group name for the virtual machine public network interface."
            }
        },
        "storageAccountsName": {
            "type": "string",
            "defaultValue": null,
            "minLength": 3,
            "maxLength": 24,
            "metadata": {
                "description": "The name of the storage account for storing the virtual machine."
            }
        },
        "diagnosticStorageAccountsName": {
            "type": "string",
            "defaultValue": null,
            "minLength": 3,
            "maxLength": 24,
            "metadata": {
                "description": "The name of the storage account for storing the virtual machine boot diagnostic."
            }
        },
        "virtualMachineName": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name of the virtual machine."
            }
        },
       "virtualMachineSize": {
           "type": "string",
           "allowedValues": [
               "Standard_A0", "Standard_A1", "Standard_A2", "Standard_A3",
               "Standard_A4", "Standard_A5", "Standard_A6", "Standard_A7",
                
               "Standard_D1_v2", "Standard_D2_v2", "Standard_D3_v2", "Standard_D4_v2",
               "Standard_D5_v2", "Standard_D6_v2", "Standard_D7_v2", "Standard_D8_v2",
               "Standard_D9_v2", "Standard_D10_v2", "Standard_D11_v2", "Standard_D12_v2",
               "Standard_D13_v2", "Standard_D14_v2", "Standard_D15_v2",
 
               "Standard_F1", "Standard_F2", "Standard_F4", "Standard_F8", "Standard_F16"
           ],
           "defaultValue": "Standard_A0",
           "metadata": {
               "description": "The size of the virtual machine."
           }
       },
       "virtualMachineDataDiskSize": {
            "type": "int",
            "defaultValue": 40,
            "minValue": 10,
            "maxValue": 1023,
            "metadata": {
                "description": "The GB size of the data disk for the virtual machine."
            }
       },
       "virtualMachineSKU":{
           "type": "string",
           "allowedValues": [
                "6.7", "6.8", "6.9", 

                "7.2", "7.3"
           ],
           "defaultValue": "7.3",
           "metadata": {
               "description": "The SKU of the Red Hat Enterprise Linux Server virtual machine."
           }
       },
        "virtualMachineNetworkInterfacesName": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name of the network interface for the virtual machine."
            }
        },
        "virtualMachinePublicIPAddressesName": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name of the public IP addresses for the virtual machine."
            }
        },
        "virtualMachineAdminUsername": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The administrator username for the virtual machine."
            }
        },
        "virtualMachineAdminPassword": {
            "type": "securestring",
            "defaultValue": null,
            "metadata": {
                "description": "The administrator password for the virtual machine."
            }
        },
        "resourceOwnerNameTag": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name of the resource owner for the Owner Name tag."
            }
        },
        "businessUnitTag": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name of the department for the Business Unit tag."
            }
        },
        "costCenterTag": {
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "A cost identifier for the Cost Center tag."
            }
        },
        "environmentTag": {
            "allowedValues": [
                null,
                "Development",
                "Staging",
                "Production"
            ],
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The name for the Environment tag."
            }
        },
        "maintenanceWindowStartTag": {
            "allowedValues": [
                null,
                "Mon 00:00", "Mon 01:00", "Mon 02:00", "Mon 03:00", "Mon 04:00", "Mon 05:00", 
                "Mon 06:00", "Mon 07:00", "Mon 08:00", "Mon 09:00", "Mon 10:00", "Mon 11:00", 
                "Mon 12:00", "Mon 13:00", "Mon 14:00", "Mon 15:00", "Mon 16:00", "Mon 17:00", 
                "Mon 18:00", "Mon 19:00", "Mon 20:00", "Mon 21:00", "Mon 22:00", "Mon 23:00",
                "Tue 00:00", "Tue 01:00", "Tue 02:00", "Tue 03:00", "Tue 04:00", "Tue 05:00",
                "Tue 06:00", "Tue 07:00", "Tue 08:00", "Tue 09:00", "Tue 10:00", "Tue 11:00",
                "Tue 12:00", "Tue 13:00", "Tue 14:00", "Tue 15:00", "Tue 16:00", "Tue 17:00",
                "Tue 18:00", "Tue 19:00", "Tue 20:00", "Tue 21:00", "Tue 22:00", "Tue 23:00",
                "Wed 00:00", "Wed 01:00", "Wed 02:00", "Wed 03:00", "Wed 04:00", "Wed 05:00",
                "Wed 06:00", "Wed 07:00", "Wed 08:00", "Wed 09:00", "Wed 10:00", "Wed 11:00",
                "Wed 12:00", "Wed 13:00", "Wed 14:00", "Wed 15:00", "Wed 16:00", "Wed 17:00",
                "Wed 18:00", "Wed 19:00", "Wed 20:00", "Wed 21:00", "Wed 22:00", "Wed 23:00",
                "Thu 00:00", "Thu 01:00", "Thu 02:00", "Thu 03:00", "Thu 04:00", "Thu 05:00",
                "Thu 06:00", "Thu 07:00", "Thu 08:00", "Thu 09:00", "Thu 10:00", "Thu 11:00",
                "Thu 12:00", "Thu 13:00", "Thu 14:00", "Thu 15:00", "Thu 16:00", "Thu 17:00",
                "Thu 18:00", "Thu 19:00", "Thu 20:00", "Thu 21:00", "Thu 22:00", "Thu 23:00",
                "Fri 00:00", "Fri 01:00", "Fri 02:00", "Fri 03:00", "Fri 04:00", "Fri 05:00",
                "Fri 06:00", "Fri 07:00", "Fri 08:00", "Fri 09:00", "Fri 10:00", "Fri 11:00",
                "Fri 12:00", "Fri 13:00", "Fri 14:00", "Fri 15:00", "Fri 16:00", "Fri 17:00",
                "Fri 18:00", "Fri 19:00", "Fri 20:00", "Fri 21:00", "Fri 22:00", "Fri 23:00",
                "Sat 00:00", "Sat 01:00", "Sat 02:00", "Sat 03:00", "Sat 04:00", "Sat 05:00",
                "Sat 06:00", "Sat 07:00", "Sat 08:00", "Sat 09:00", "Sat 10:00", "Sat 11:00",
                "Sat 12:00", "Sat 13:00", "Sat 14:00", "Sat 15:00", "Sat 16:00", "Sat 17:00",
                "Sat 18:00", "Sat 19:00", "Sat 20:00", "Sat 21:00", "Sat 22:00", "Sat 23:00",
                "Sun 00:00", "Sun 01:00", "Sun 02:00", "Sun 03:00", "Sun 04:00", "Sun 05:00",
                "Sun 06:00", "Sun 07:00", "Sun 08:00", "Sun 09:00", "Sun 10:00", "Sun 11:00",
                "Sun 12:00", "Sun 13:00", "Sun 14:00", "Sun 15:00", "Sun 16:00", "Sun 17:00",
                "Sun 18:00", "Sun 19:00", "Sun 20:00", "Sun 21:00", "Sun 22:00", "Sun 23:00"
            ],
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The start of the maintenance (Mon, Tue, Wed, Thu, Fri, Sat or Sun HH:mm) schedule of the resource for Maintenance Window Start tag."
            }
        },
        "maintenanceWindowEndTag": {
            "allowedValues": [
                null,
                "Mon 00:00", "Mon 01:00", "Mon 02:00", "Mon 03:00", "Mon 04:00", "Mon 05:00", 
                "Mon 06:00", "Mon 07:00", "Mon 08:00", "Mon 09:00", "Mon 10:00", "Mon 11:00", 
                "Mon 12:00", "Mon 13:00", "Mon 14:00", "Mon 15:00", "Mon 16:00", "Mon 17:00", 
                "Mon 18:00", "Mon 19:00", "Mon 20:00", "Mon 21:00", "Mon 22:00", "Mon 23:00",
                "Tue 00:00", "Tue 01:00", "Tue 02:00", "Tue 03:00", "Tue 04:00", "Tue 05:00",
                "Tue 06:00", "Tue 07:00", "Tue 08:00", "Tue 09:00", "Tue 10:00", "Tue 11:00",
                "Tue 12:00", "Tue 13:00", "Tue 14:00", "Tue 15:00", "Tue 16:00", "Tue 17:00",
                "Tue 18:00", "Tue 19:00", "Tue 20:00", "Tue 21:00", "Tue 22:00", "Tue 23:00",
                "Wed 00:00", "Wed 01:00", "Wed 02:00", "Wed 03:00", "Wed 04:00", "Wed 05:00",
                "Wed 06:00", "Wed 07:00", "Wed 08:00", "Wed 09:00", "Wed 10:00", "Wed 11:00",
                "Wed 12:00", "Wed 13:00", "Wed 14:00", "Wed 15:00", "Wed 16:00", "Wed 17:00",
                "Wed 18:00", "Wed 19:00", "Wed 20:00", "Wed 21:00", "Wed 22:00", "Wed 23:00",
                "Thu 00:00", "Thu 01:00", "Thu 02:00", "Thu 03:00", "Thu 04:00", "Thu 05:00",
                "Thu 06:00", "Thu 07:00", "Thu 08:00", "Thu 09:00", "Thu 10:00", "Thu 11:00",
                "Thu 12:00", "Thu 13:00", "Thu 14:00", "Thu 15:00", "Thu 16:00", "Thu 17:00",
                "Thu 18:00", "Thu 19:00", "Thu 20:00", "Thu 21:00", "Thu 22:00", "Thu 23:00",
                "Fri 00:00", "Fri 01:00", "Fri 02:00", "Fri 03:00", "Fri 04:00", "Fri 05:00",
                "Fri 06:00", "Fri 07:00", "Fri 08:00", "Fri 09:00", "Fri 10:00", "Fri 11:00",
                "Fri 12:00", "Fri 13:00", "Fri 14:00", "Fri 15:00", "Fri 16:00", "Fri 17:00",
                "Fri 18:00", "Fri 19:00", "Fri 20:00", "Fri 21:00", "Fri 22:00", "Fri 23:00",
                "Sat 00:00", "Sat 01:00", "Sat 02:00", "Sat 03:00", "Sat 04:00", "Sat 05:00",
                "Sat 06:00", "Sat 07:00", "Sat 08:00", "Sat 09:00", "Sat 10:00", "Sat 11:00",
                "Sat 12:00", "Sat 13:00", "Sat 14:00", "Sat 15:00", "Sat 16:00", "Sat 17:00",
                "Sat 18:00", "Sat 19:00", "Sat 20:00", "Sat 21:00", "Sat 22:00", "Sat 23:00",
                "Sun 00:00", "Sun 01:00", "Sun 02:00", "Sun 03:00", "Sun 04:00", "Sun 05:00",
                "Sun 06:00", "Sun 07:00", "Sun 08:00", "Sun 09:00", "Sun 10:00", "Sun 11:00",
                "Sun 12:00", "Sun 13:00", "Sun 14:00", "Sun 15:00", "Sun 16:00", "Sun 17:00",
                "Sun 18:00", "Sun 19:00", "Sun 20:00", "Sun 21:00", "Sun 22:00", "Sun 23:00"
            ],
            "type": "string",
            "defaultValue": null,
            "metadata": {
                "description": "The end of the maintenance (Mon, Tue, Wed, Thu, Fri, Sat or Sun HH:mm) schedule of the resource for Maintenance Window End tag."
            }
        },
        "expirationDateTag": {
            "type": "string",
            "defaultValue": "yyyy-MM-dd HH:mm:ss",
            "metadata": {
                "description": "The expiration (yyyy-MM-dd HH:mm:ss) schedule of the resource for Expiration Date tag."
            }
        }
    },
    "variables": {},
    "resources": [
        {
            "comments": "Creates the virtual machine.",
            "type": "Microsoft.Compute/virtualMachines",
            "name": "[parameters('virtualMachineName')]",
            "apiVersion": "2015-06-15",
            "location": "[resourceGroup().location]",
            "tags": {
                "ResourceOwner": "[parameters('resourceOwnerNameTag')]",
                "BusinessUnit": "[parameters('businessUnitTag')]",
                "CostCenter": "[parameters('costCenterTag')]",
                "Environment": "[parameters('environmentTag')]",
                "MaintenanceWindowStart": "[parameters('maintenanceWindowStartTag')]",
                "MaintenanceWindowEnd": "[parameters('maintenanceWindowEndTag')]",
                "ExpirationDate": "[parameters('expirationDateTag')]"
            },
            "properties": {
                "hardwareProfile": {
                    "vmSize": "[parameters('virtualMachineSize')]"
                },
                "storageProfile": {
                    "imageReference": {
                        "publisher": "RedHat",
                        "offer": "RHEL",
                        "sku": "[parameters('virtualMachineSKU')]",
                        "version": "latest"
                    },
                    "osDisk": {
                        "name": "[parameters('virtualMachineName')]",
                        "createOption": "FromImage",
                        "vhd": {
                            "uri": "[concat('https', '://', parameters('storageAccountsName'), '.blob.core.windows.net', concat('/vhds/', parameters('virtualMachineName'),'_OperatingSystem.vhd'))]"
                        },
                        "caching": "ReadWrite"
                    },
                    "dataDisks": [
                         {
                            "name": "Data",
                            "diskSizeGB": "[parameters('virtualMachineDataDiskSize')]",
                            "lun": 0,
                            "vhd": {
                                "uri": "[concat('https', '://', parameters('storageAccountsName'), '.blob.core.windows.net', concat('/vhds/', parameters('virtualMachineName'),'_Data.vhd'))]"
                            },  
                            "createOption": "Empty"
                        }
                    ]
                },
                "osProfile": {
                    "computerName": "[parameters('virtualMachineName')]",
                    "adminUsername": "[parameters('virtualMachineAdminUsername')]",
                    "linuxConfiguration": {
                        "disablePasswordAuthentication": false
                    },
                    "secrets": [],
                    "adminPassword": "[parameters('virtualMachineAdminPassword')]"
                },
                "networkProfile": {
                    "networkInterfaces": [
                        {
                            "id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('virtualMachineNetworkInterfacesName'))]"
                        }
                    ]
                }
            },
            "resources": [],
            "dependsOn": [
                "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountsName'))]",
                "[resourceId('Microsoft.Network/networkInterfaces', parameters('virtualMachineNetworkInterfacesName'))]"
            ]
        },
        {
            "comments": "Creates the network interfaces for the virtual machine.",
            "type": "Microsoft.Network/networkInterfaces",
            "name": "[parameters('virtualMachineNetworkInterfacesName')]",
            "apiVersion": "2016-03-30",
            "location": "[resourceGroup().location]",
            "tags": {
                "ResourceOwner": "[parameters('resourceOwnerNameTag')]",
                "BusinessUnit": "[parameters('businessUnitTag')]",
                "CostCenter": "[parameters('costCenterTag')]",
                "Environment": "[parameters('environmentTag')]",
                "MaintenanceWindowStart": "[parameters('maintenanceWindowStartTag')]",
                "MaintenanceWindowEnd": "[parameters('maintenanceWindowEndTag')]",
                "ExpirationDate": "[parameters('expirationDateTag')]"
            },
            "properties": {
                "ipConfigurations": [
                    {
                        "name": "ipconfig1",
                        "properties": {
                            "privateIPAddress": "10.0.0.4",
                            "privateIPAllocationMethod": "Dynamic",
                            "publicIPAddress": {
                                "id": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('virtualMachinePublicIPAddressesName'))]"
                            },
                            "subnet": {
                                "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworksName')), '/subnets/', parameters('virtualNetworkSubnetName'))]"
                            }
                        }
                    }
                ],
                "dnsSettings": {
                    "dnsServers": []
                },
                "enableIPForwarding": false,
                "networkSecurityGroup": {
                    "id": "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupsName'))]"
                }
            },
            "resources": [],
            "dependsOn": [
                "[resourceId('Microsoft.Network/publicIPAddresses', parameters('virtualMachinePublicIPAddressesName'))]",
                "[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworksName'))]",
                "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupsName'))]"
            ]
        },
        {
            "comments": "Create a network security group for the virtual machine public network interface.",
            "type": "Microsoft.Network/networkSecurityGroups",
            "name": "[parameters('networkSecurityGroupsName')]",
            "apiVersion": "2016-03-30",
            "location": "[resourceGroup().location]",
            "tags": {
                "ResourceOwner": "[parameters('resourceOwnerNameTag')]",
                "BusinessUnit": "[parameters('businessUnitTag')]",
                "CostCenter": "[parameters('costCenterTag')]",
                "Environment": "[parameters('environmentTag')]",
                "MaintenanceWindowStart": "[parameters('maintenanceWindowStartTag')]",
                "MaintenanceWindowEnd": "[parameters('maintenanceWindowEndTag')]",
                "ExpirationDate": "[parameters('expirationDateTag')]"
            },
            "properties": {
                "securityRules": [
                    {
                        "name": "default-allow-ssh",
                        "properties": {
                            "protocol": "Tcp",
                            "sourcePortRange": "*",
                            "destinationPortRange": "22",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 1000,
                            "direction": "Inbound"
                        }
                    }
                ]
            },
            "resources": [],
            "dependsOn": []
        },
        {
            "comments": "Creates the public IP addresses for the virtual machine.",
            "type": "Microsoft.Network/publicIPAddresses",
            "name": "[parameters('virtualMachinePublicIPAddressesName')]",
            "apiVersion": "2016-03-30",
            "location": "[resourceGroup().location]",
            "tags": {
                "ResourceOwner": "[parameters('resourceOwnerNameTag')]",
                "BusinessUnit": "[parameters('businessUnitTag')]",
                "CostCenter": "[parameters('costCenterTag')]",
                "Environment": "[parameters('environmentTag')]",
                "MaintenanceWindowStart": "[parameters('maintenanceWindowStartTag')]",
                "MaintenanceWindowEnd": "[parameters('maintenanceWindowEndTag')]",
                "ExpirationDate": "[parameters('expirationDateTag')]"
            },
            "properties": {
                "publicIPAllocationMethod": "Dynamic",
                "idleTimeoutInMinutes": 4
            },
            "resources": [],
            "dependsOn": []
        },
        {
            "comments": "Creates the virtual networks for the environment.",
            "type": "Microsoft.Network/virtualNetworks",
            "name": "[parameters('virtualNetworksName')]",
            "apiVersion": "2016-03-30",
            "location": "[resourceGroup().location]",
            "tags": {
                "ResourceOwner": "[parameters('resourceOwnerNameTag')]",
                "BusinessUnit": "[parameters('businessUnitTag')]",
                "CostCenter": "[parameters('costCenterTag')]",
                "Environment": "[parameters('environmentTag')]",
                "MaintenanceWindowStart": "[parameters('maintenanceWindowStartTag')]",
                "MaintenanceWindowEnd": "[parameters('maintenanceWindowEndTag')]",
                "ExpirationDate": "[parameters('expirationDateTag')]"
            },
            "properties": {
                "addressSpace": {
                    "addressPrefixes": [
                        "[parameters('virtualNetworkAddressPrefix')]"
                    ]
                },
                "subnets": [
                    {
                        "name": "[parameters('virtualNetworkSubnetName')]",
                        "properties": {
                            "addressPrefix": "[parameters('virtualNetworkSubnetAddressPrefix')]"
                        }
                    }
                ]
            },
            "resources": [],
            "dependsOn": []
        },
        {
            "comments": "Creates the disgnostic storage account to store the virtual machine boot diagnostic.",
            "type": "Microsoft.Storage/storageAccounts",
            "sku": {
                "name": "Standard_LRS",
                "tier": "Standard"
            },
            "kind": "Storage",
            "name": "[parameters('diagnosticStorageAccountsName')]",
            "apiVersion": "2016-01-01",
            "location": "[resourceGroup().location]",
            "tags": {
                "ResourceOwner": "[parameters('resourceOwnerNameTag')]",
                "BusinessUnit": "[parameters('businessUnitTag')]",
                "CostCenter": "[parameters('costCenterTag')]",
                "Environment": "[parameters('environmentTag')]",
                "MaintenanceWindowStart": "[parameters('maintenanceWindowStartTag')]",
                "MaintenanceWindowEnd": "[parameters('maintenanceWindowEndTag')]",
                "ExpirationDate": "[parameters('expirationDateTag')]"
            },
            "properties": {},
            "resources": [],
            "dependsOn": []
        },
        {
            "comments": "Creates the storage account to store the virtual machine.",
            "type": "Microsoft.Storage/storageAccounts",
            "sku": {
                "name": "Standard_LRS",
                "tier": "Standard"
            },
            "kind": "Storage",
            "name": "[parameters('storageAccountsName')]",
            "apiVersion": "2016-01-01",
            "location": "[resourceGroup().location]",
            "tags": {
                "ResourceOwner": "[parameters('resourceOwnerNameTag')]",
                "BusinessUnit": "[parameters('businessUnitTag')]",
                "CostCenter": "[parameters('costCenterTag')]",
                "Environment": "[parameters('environmentTag')]",
                "MaintenanceWindowStart": "[parameters('maintenanceWindowStartTag')]",
                "MaintenanceWindowEnd": "[parameters('maintenanceWindowEndTag')]",
                "ExpirationDate": "[parameters('expirationDateTag')]"
            },
            "properties": {},
            "resources": [],
            "dependsOn": []
        }
    ]
}

2.2. Select Deploy on the Template that you have just created in Azure Templates with the copied JSON code and fill up the form during provisioning

2017-03-11-azure-iac-arm-2-templates-deploy-rhel-server-virtual-machine-on-independent-virtual-network-subnet

Once you have deployed either one of the Linux distro virtual machine using the ARM Template, you will probably wonder how you can management the Linux virtual machine in Azure.

 

In the Azure Portal, when you navigate to the virtual machine and try to connect to the virtual machine. You will notice that the connect button will provide you the SSH Shell command to establish a SSH session to the Linux virtual machine.

2017-03-11-azure-iac-arm-3-templates-connect-to-rhel-virtual-machine

If you are using a Linux distro desktop or Mac OS desktop, you can launch the shell terminal and input the SSH command to start establishing a SSH session to your Linux virtual machine in Azure.

 

For Windows desktop users, you either download PuTTY or PoSH-SSH PowerShell to establish a SSH session with the Linux virtual machine in Azure.

 

In this example, I will demonstrate using PuTTY where you will have to input the Public IP Address of the Host and select Open.

2017-03-11-azure-iac-arm-4-templates-connect-to-rhel-virtual-machine-using-putty-for-windows

 

Next, you will have to accept the newly deployed Linux virtual machine self-signed certificate to establish the SSH connection with your machine.

2017-03-11-azure-iac-arm-5-templates-select-yes-to-accept-rhel-virtual-machine-certificate-on-putty

 

Conclusion

Voila. Now, you can have Ubuntu or Red Hat Enterprise Linux virtual machine easily deployed or provisioned in a breeze within Azure. Because we can predefine the necessary parameters in the ARM Template in JSON format, we can ensure that we have a consistent deployment form’s look and feel for anyone to fill up the information. Thus, reducing the learning curve or documentation of the provisioning process.

2017-03-11-azure-iac-arm-6-templates-established-ssh-session-with-rhel-virtual-machine-on-putty

 

Additional Resources

 

See Also