Common questions about VM in Azure Marketplace

These frequently asked questions (FAQ) cover common issues you might encounter when creating a virtual machine (VM) offer in Azure Marketplace.

How do I configure a virtual private network (VPN) to work with my VMs?

What are Microsoft support policies for running Microsoft server software on Azure-based VMs?

In a VM, how do I manage the custom script extension in the startup task?

For details on using the Custom Script Extension using the Azure PowerShell module, Azure Resource Manager templates, and troubleshooting steps on Windows systems, see Custom Script Extension for Windows.

Are 32-bit applications or services supported in Azure Marketplace?

No. The supported operating systems and standard services for Azure VMs are all 64-bit. Though most 64-bit operating systems support 32-bit versions of applications for backward compatibility, using 32-bit applications as part of your VM solution is unsupported and highly discouraged. Recreate your application as a 64-bit project.

For more information, see these articles:

Error: VHD is already registered with image repository as the resource

Every time I try to create an image from my VHDs, I get the error "VHD is already registered with image repository as the resource" in Azure PowerShell. I didn't create any image before nor did I find any image with this name in Azure. How do I resolve this issue?

This issue usually appears if you created a VM from a VHD that has a lock on it. Confirm that there's no VM allocated from this VHD and then retry the operation. If this issue continues, open a support ticket. See Support for Partner Center.

How do I create a VM from a generalized vhd?

Prepare an Azure Resource Manager template

This section describes how to create and deploy a user-provided virtual machine (VM) image by providing operating system and data disk VHD images from an Azure-deployed virtual hard disk. These steps deploy the VM using generalized VHD.

  1. Sign in to the Azure portal.

  2. Upload your generalized operating system VHD and data disk VHDs to your Azure Storage account.

  3. On the home page, select Create a resource. Search for "template deployment" and select Create.

  4. Choose Build your own template in the editor.

    Shows the selection of a template

  5. Paste the following JSON template into the editor and select Save.

     {
          "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
          "contentVersion": "1.0.0.0",
          "parameters": {
              "userStorageAccountName": {
                  "type": "String"
              },
              "userStorageContainerName": {
                  "defaultValue": "vhds",
                  "type": "String"
              },
              "dnsNameForPublicIP": {
                  "type": "String"
              },
              "adminUserName": {
                  "defaultValue": "isv",
                  "type": "String"
              },
              "adminPassword": {
                  "defaultValue": "",
                  "type": "SecureString"
              },
              "osType": {
                  "defaultValue": "windows",
                  "allowedValues": [
                      "windows",
                      "linux"
                  ],
                  "type": "String"
              },
              "subscriptionId": {
                  "type": "String"
              },
              "location": {
                  "type": "String"
              },
              "vmSize": {
                  "type": "String"
              },
              "publicIPAddressName": {
                  "type": "String"
              },
              "vmName": {
                  "type": "String"
              },
              "virtualNetworkName": {
                  "type": "String"
              },
              "nicName": {
                  "type": "String"
              },
              "vhdUrl": {
                  "type": "String",
                  "metadata": {
                      "description": "VHD Url..."
                  }
              }
          },
          "variables": {
              "addressPrefix": "10.0.0.0/16",
              "subnet1Name": "Subnet-1",
              "subnet2Name": "Subnet-2",
              "subnet1Prefix": "10.0.0.0/24",
              "subnet2Prefix": "10.0.1.0/24",
              "publicIPAddressType": "Dynamic",
              "vnetID": "[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]",
              "subnet1Ref": "[concat(variables('vnetID'),'/subnets/',variables('subnet1Name'))]",
              "hostDNSNameScriptArgument": "[concat(parameters('dnsNameForPublicIP'),'.',parameters('location'),'.cloudapp.azure.com')]",
              "osDiskVhdName": "[concat('http://',parameters('userStorageAccountName'),'.blob.core.windows.net/',parameters('userStorageContainerName'),'/',parameters('vmName'),'osDisk.vhd')]"
          },
          "resources": [
              {
                  "type": "Microsoft.Network/publicIPAddresses",
                  "apiVersion": "2015-06-15",
                  "name": "[parameters('publicIPAddressName')]",
                  "location": "[parameters('location')]",
                  "properties": {
                      "publicIPAllocationMethod": "[variables('publicIPAddressType')]",
                      "dnsSettings": {
                          "domainNameLabel": "[parameters('dnsNameForPublicIP')]"
                      }
                  }
              },
              {
                  "type": "Microsoft.Network/virtualNetworks",
                  "apiVersion": "2015-06-15",
                  "name": "[parameters('virtualNetworkName')]",
                  "location": "[parameters('location')]",
                  "properties": {
                      "addressSpace": {
                          "addressPrefixes": [
                              "[variables('addressPrefix')]"
                          ]
                      },
                      "subnets": [
                          {
                              "name": "[variables('subnet1Name')]",
                              "properties": {
                                  "addressPrefix": "[variables('subnet1Prefix')]"
                              }
                          },
                          {
                              "name": "[variables('subnet2Name')]",
                              "properties": {
                                  "addressPrefix": "[variables('subnet2Prefix')]"
                              }
                          }
                      ]
                  }
              },
              {
                  "type": "Microsoft.Network/networkInterfaces",
                  "apiVersion": "2015-06-15",
                  "name": "[parameters('nicName')]",
                  "location": "[parameters('location')]",
                  "dependsOn": [
                      "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]",
                      "[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]"
                  ],
                  "properties": {
                      "ipConfigurations": [
                          {
                              "name": "ipconfig1",
                              "properties": {
                                  "privateIPAllocationMethod": "Dynamic",
                                  "publicIPAddress": {
                                      "id": "[resourceId('Microsoft.Network/publicIPAddresses',parameters('publicIPAddressName'))]"
                                  },
                                  "subnet": {
                                      "id": "[variables('subnet1Ref')]"
                                  }
                              }
                          }
                      ]
                  }
              },
              {
                  "type": "Microsoft.Compute/virtualMachines",
                  "apiVersion": "2015-06-15",
                  "name": "[parameters('vmName')]",
                  "location": "[parameters('location')]",
                  "dependsOn": [
                      "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]"
                  ],
                  "properties": {
                      "hardwareProfile": {
                          "vmSize": "[parameters('vmSize')]"
                      },
                      "osProfile": {
                          "computername": "[parameters('vmName')]",
                          "adminUsername": "[parameters('adminUsername')]",
                          "adminPassword": "[parameters('adminPassword')]"
                      },
                      "storageProfile": {
                          "osDisk": {
                              "name": "[concat(parameters('vmName'),'-osDisk')]",
                              "osType": "[parameters('osType')]",
                              "caching": "ReadWrite",
                              "image": {
                                  "uri": "[parameters('vhdUrl')]"
                              },
                              "vhd": {
                                  "uri": "[variables('osDiskVhdName')]"
                              },
                              "createOption": "FromImage"
                          }
                      },
                      "networkProfile": {
                          "networkInterfaces": [
                              {
                                  "id": "[resourceId('Microsoft.Network/networkInterfaces',parameters('nicName'))]"
                              }
                          ]
                      }
                  }
              }
          ]
      }
    
  6. Provide the parameter values for the displayed Custom deployment property pages.

    ResourceGroupName Existing Azure resource group name. Typically, use the same RG as your key vault.
    TemplateFile Full pathname to the file VHDtoImage.json.
    userStorageAccountName Name of the storage account.
    dnsNameForPublicIP DNS name for the public IP; must be lowercase.
    subscriptionId Azure subscription identifier.
    Location Standard Azure geographic location of the resource group.
    vmName Name of the virtual machine.
    vhdUrl Web address of the virtual hard disk.
    vmSize Size of the virtual machine instance.
    publicIPAddressName Name of the public IP address.
    virtualNetworkName Name of the virtual network.
    nicName Name of the network interface card for the virtual network.
    adminUserName Username of the administrator account.
    adminPassword Administrator password.
  7. After you supply these values, select Purchase.

    Azure begins the deployment. It creates a new VM with the specified unmanaged VHD in the specified storage account path. You can track the progress in the Azure portal by selecting Virtual Machines on the left side of the portal. When the VM is created, the status changes from Starting to Running.

    For generation 2 VM deployment, use this template:

    {
         "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
         "contentVersion": "1.0.0.0",
         "parameters": {
             "userStorageAccountName": {
                 "type": "String"
             },
             "userStorageContainerName": {
                 "defaultValue": "vhds",
                 "type": "String"
             },
             "dnsNameForPublicIP": {
                 "type": "String"
             },
             "adminUserName": {
                 "defaultValue": "isv",
                 "type": "String"
             },
             "adminPassword": {
                 "defaultValue": "",
                 "type": "SecureString"
             },
             "osType": {
                 "defaultValue": "windows",
                 "allowedValues": [
                     "windows",
                     "linux"
                 ],
                 "type": "String"
             },
             "subscriptionId": {
                 "type": "String"
             },
             "location": {
                 "type": "String"
             },
             "vmSize": {
                 "type": "String"
             },
             "publicIPAddressName": {
                 "type": "String"
             },
             "vmName": {
                 "type": "String"
             },
             "virtualNetworkName": {
                 "type": "String"
             },
             "nicName": {
                 "type": "String"
             },
             "vhdUrl": {
                 "type": "String",
                 "metadata": {
                     "description": "VHD Url..."
                 }
             }
         },
         "variables": {
             "addressPrefix": "10.0.0.0/16",
             "subnet1Name": "Subnet-1",
             "subnet2Name": "Subnet-2",
             "subnet1Prefix": "10.0.0.0/24",
             "subnet2Prefix": "10.0.1.0/24",
             "publicIPAddressType": "Dynamic",
             "vnetID": "[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]",
             "subnet1Ref": "[concat(variables('vnetID'),'/subnets/',variables('subnet1Name'))]",
             "hostDNSNameScriptArgument": "[concat(parameters('dnsNameForPublicIP'),'.',parameters('location'),'.cloudapp.azure.com')]",
             "osDiskVhdName": "[concat('http://',parameters('userStorageAccountName'),'.blob.core.windows.net/',parameters('userStorageContainerName'),'/',parameters('vmName'),'osDisk.vhd')]"
         },
         "resources": [
             {
                 "type": "Microsoft.Network/publicIPAddresses",
                 "apiVersion": "2015-06-15",
                 "name": "[parameters('publicIPAddressName')]",
                 "location": "[parameters('location')]",
                 "properties": {
                     "publicIPAllocationMethod": "[variables('publicIPAddressType')]",
                     "dnsSettings": {
                         "domainNameLabel": "[parameters('dnsNameForPublicIP')]"
                     }
                 }
             },
             {
                 "type": "Microsoft.Network/virtualNetworks",
                 "apiVersion": "2015-06-15",
                 "name": "[parameters('virtualNetworkName')]",
                 "location": "[parameters('location')]",
                 "properties": {
                     "addressSpace": {
                         "addressPrefixes": [
                             "[variables('addressPrefix')]"
                         ]
                     },
                     "subnets": [
                         {
                             "name": "[variables('subnet1Name')]",
                             "properties": {
                                 "addressPrefix": "[variables('subnet1Prefix')]"
                             }
                         },
                         {
                             "name": "[variables('subnet2Name')]",
                             "properties": {
                                 "addressPrefix": "[variables('subnet2Prefix')]"
                             }
                         }
                     ]
                 }
             },
             {
                 "type": "Microsoft.Network/networkInterfaces",
                 "apiVersion": "2015-06-15",
                 "name": "[parameters('nicName')]",
                 "location": "[parameters('location')]",
                 "dependsOn": [
                     "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]",
                     "[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]"
                 ],
                 "properties": {
                     "ipConfigurations": [
                         {
                             "name": "ipconfig1",
                             "properties": {
                                 "privateIPAllocationMethod": "Dynamic",
                                 "publicIPAddress": {
                                     "id": "[resourceId('Microsoft.Network/publicIPAddresses',parameters('publicIPAddressName'))]"
                                 },
                                 "subnet": {
                                     "id": "[variables('subnet1Ref')]"
                                 }
                             }
                         }
                     ]
                 }
             },
             {
                 "type": "Microsoft.Compute/virtualMachines",
                 "apiVersion": "2015-06-15",
                 "name": "[parameters('vmName')]",
                 "location": "[parameters('location')]",
                 "dependsOn": [
                     "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]"
                 ],
                 "properties": {
                     "hardwareProfile": {
                         "vmSize": "[parameters('vmSize')]"
                     },
                     "osProfile": {
                         "computername": "[parameters('vmName')]",
                         "adminUsername": "[parameters('adminUsername')]",
                         "adminPassword": "[parameters('adminPassword')]"
                     },
                     "storageProfile": {
                         "osDisk": {
                             "name": "[concat(parameters('vmName'),'-osDisk')]",
                             "osType": "[parameters('osType')]",
                             "caching": "ReadWrite",
                             "image": {
                                 "uri": "[parameters('vhdUrl')]"
                             },
                             "vhd": {
                                 "uri": "[variables('osDiskVhdName')]"
                             },
                             "createOption": "FromImage"
                         }
                     },
                     "networkProfile": {
                         "networkInterfaces": [
                             {
                                 "id": "[resourceId('Microsoft.Network/networkInterfaces',parameters('nicName'))]"
                             }
                         ]
                     }
                 }
             }
         ]
     }
    

Deploy an Azure VM using PowerShell

Copy and edit the following script to provide values for the $storageaccount and $vhdUrl variables. Execute it to create an Azure VM resource from your existing generalized VHD.

# storage account of existing generalized VHD
$storageaccount = "testwinrm11815"
# generalized VHD URL
$vhdUrl = "https://testwinrm11815.blob.core.windows.net/vhds/testvm1234562016651857.vhd"

echo "New-AzResourceGroupDeployment -Name "dplisvvm$postfix" -ResourceGroupName "$rgName" -TemplateFile "C:\certLocation\VHDtoImage.json" -userStorageAccountName "$storageaccount" -dnsNameForPublicIP "$vmName" -subscriptionId "$mysubid" -location "$location" -vmName "$vmName" -vaultName "$kvname" -vaultResourceGroup "$rgName" -certificateUrl
$objAzureKeyVaultSecret.Id -vhdUrl "$vhdUrl" -vmSize "Standard\_A2" -publicIPAddressName "myPublicIP1" -virtualNetworkName "myVNET1" -nicName "myNIC1" -adminUserName "isv" -adminPassword $pwd"

# deploying VM with existing VHD
New-AzResourceGroupDeployment -Name "dplisvvm$postfix" -ResourceGroupName "$rgName"

How do I test a hidden preview image?

You can deploy hidden preview images using quickstart templates. To deploy a preview image,

  1. Go to the respective quick-start template for Linux or Windows, select Deploy to Azure. This procedure should take you to Azure portal.
  2. In Azure portal, select Edit template.
  3. In the JSON template, search for imageReference and update the publisherid, offerid, skuid, and version of the image. To test preview image, append "-PREVIEW" to the offerid.
  4. Select Save.
  5. Fill out the rest of the details. Review and Create