Create Access Gateway VM
To create a Microsoft Azure virtual machine, you must first define it, then associate a previously created disk with the new virtual machine.
Currently there is no way to build a virtual machine using the Microsoft Azure Portal and attach a previously created disk as the operating system disk. See the Command Line tab for details on creating a virtual machine using the command line.
Ensure that you have run the az disk revoke-access command before creating the disk. Failure to revoke prior access to the disk can cause the virtual machine command to time out, or fail completely due to the disk being unavailable.
-
Using the az disk list command, list the details of available disks.
az disk list --resource-group <resource-group>
- <resource-group> is the name of the previously created resource group.
Here is an example of the az disk list command with the parameter populated with a value:
az disk list --resource-group AccessGatewayWhen you run the az disk list command, the following results appear:
{ . . . "encryptionSettingsCollection": null,"hyperVgeneration": "V1", "id": "/subscriptions/8bc.../resourceGroups/AccessGateway. . ./disks/AG2020-05-00", "location": "eastus", . . . } - Create a virtual machine using the az vm create command:
az vm create --resource-group <resource-group> --location <region>> \\ --size <size of VM> \\ --name <name-of-VM> --os-type linux --attach-os-disk <virtual-disk>
- <region> is the region to hold the virtual machine.
- <size> is the sku of the size of the virtual machine. See az vm list-skus --location <region> --output table for a list of available size SKUs.
- <name-of-vm> is an name for the virtual machine.
- <virtual-disk> is the name of the virtual disk to associate with the virtual machine.
- <resource-group> is the name of the previously created resource group to house the virtual machine.
Here is an example of the az vm create command with the parameters populated with values:
az vm create --resource-group AccessGateway --location eastus \ --name AccessGateway --os-type linux \ --attach-os-disk AccessGatewayDisk --size Standard_D2s_v3
When you run the az vm create command, the following results appear:
{- Finished .. "fqdns": "", "id": "/subscriptions/508555fa. . . /resourceGroups/AccessGateway/providers/Microsoft.Compute/virtualMachines/OAG5.0VM", "location": "eastus", "macAddress": "00-0D-3A-0E-9C-C1", "powerState": "VM running", "privateIpAddress": "10.0.0.5", "publicIpAddress": "52.167.120.101", "resourceGroup": "AccessGateway", "zones": "" }
Related topics
For more information on Managing Resource groups using the MS Azure command-line interface, see Manage Azure resources using Azure CLI.
For more information on Managing Resource groups using the MS Azure user interface, see Manage Azure resource groups using the Azure portal.