Azure Marketplace 中 VM 的常見問題

這些常見問題 (FAQ) 涵蓋您在 Azure Marketplace 中建立虛擬機 (VM) 供應專案時可能會遇到的常見問題。

如何設定虛擬專用網 (VPN) 以使用我的 VM?

如果您使用 Azure Resource Manager 部署模型,您有三個選項:

在 Azure 型 VM 上執行Microsoft伺服器軟體Microsoft支持原則為何?

在 VM 中,如何管理啟動工作中自定義腳本擴充功能?

如需使用 Azure PowerShell 模組、Azure Resource Manager 範本和 Windows 系統上的自定義腳本擴充功能的詳細數據,請參閱 適用於 Windows 的自定義腳本擴充功能

Azure Marketplace 是否支援 32 位應用程式或服務?

不。 Azure VM 支援的作系統和標準服務全都是 64 位。 雖然大部分的64位作系統都支援32位版本的應用程式以提供回溯相容性,但不支援使用32位應用程式作為VM解決方案的一部分,且強烈建議您。 將您的應用程式重新建立為64位專案。

如需詳細資訊,請參閱下列文章:

錯誤:VHD 已向映像存放庫註冊為資源

每次我嘗試從 VHD 建立映射時,我都會在 Azure PowerShell 中收到「已向映射存放庫註冊為資源」錯誤。 我之前未建立任何映像,也沒有在 Azure 中找到任何具有此名稱的映像。 如何解決此問題?

如果您從具有鎖定的 VHD 建立 VM,通常會出現此問題。 確認此 VHD 中未配置任何 VM,然後重試作業。 如果此問題持續發生,請開啟支援票證。 請參閱合作夥伴中心 支援。

如何從一般化 vhd 建立 VM?

準備 Azure Resource Manager 範本

本節說明如何藉由從 Azure 部署的虛擬硬碟提供作系統和數據磁碟 VHD 映射,來建立及部署使用者提供的虛擬機 (VM) 映射。 這些步驟會使用一般化 VHD 來部署 VM。

  1. 登入 Azure 入口網站。

  2. 將您的一般化作系統 VHD 和數據磁碟 VHD 上傳至您的 Azure 儲存器帳戶。

  3. 在首頁上,選取 [建立資源。 搜尋「範本部署」,然後選取 [建立]

  4. 在編輯器中選擇 [建置您自己的範本]。

    顯示範本選取專案

  5. 將下列 JSON 範本貼到編輯器中,然後選取 [儲存 ]。

     {
          "$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. 提供所顯示自定義部署屬性頁的參數值。

    ResourceGroupName 現有的 Azure 資源組名。 一般而言,使用與金鑰保存庫相同的 RG。
    TemplateFile 檔案的完整路徑名稱 VHDtoImage.json。
    userStorageAccountName 記憶體帳戶的名稱。
    dnsNameForPublicIP 公用IP的 DNS 名稱;必須是小寫。
    subscriptionId Azure 訂用帳戶標識碼。
    位置 資源群組的標準 Azure 地理位置。
    vmName 虛擬機的名稱。
    vhdUrl 虛擬硬碟的網址。
    vmSize 虛擬機實例的大小。
    publicIPAddressName 公用IP位址名稱。
    virtualNetworkName 虛擬網路的名稱。
    nicName 虛擬網路的網路適配器名稱。
    adminUserName 系統管理員帳戶的用戶名稱。
    adminPassword 系統管理員密碼。
  7. 提供這些值之後,請選擇 [購買]

    Azure 會開始部署。 它會在指定的記憶體帳戶路徑中建立具有指定非受控 VHD 的新 VM。 您可以選取入口網站左側的 [虛擬機],以追蹤 Azure 入口網站中的進度。 建立 VM 時,狀態會從 [開始] 變更為 [執行中]。

    針對第 2 代 VM 部署,請使用此範本:

    {
         "$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'))]"
                             }
                         ]
                     }
                 }
             }
         ]
     }
    

使用 PowerShell 部署 Azure VM

複製並編輯下列腳本,以提供 $storageaccount$vhdUrl 變數的值。 執行它,從現有的一般化 VHD 建立 Azure VM 資源。

# 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"

如何測試隱藏的預覽影像?

您可以使用快速入門範本來部署隱藏的預覽映像。 若要部署預覽映像,

  1. 移至 LinuxWindows的個別快速入門範本,選取 [部署至 Azure]。 此程序應該會帶您前往 Azure 入口網站。
  2. 在 Azure 入口網站中,選取 [編輯範本]
  3. 在 JSON 範本中,搜尋 imageReference 並更新 publisherid、offerid、skuid 和映像版本。 若要測試預覽影像,請將 “-PREVIEW” 附加至 offerid。
  4. 選取 [儲存]。
  5. 填寫其餘的詳細數據。 檢閱和建立