这些常见问题(常见问题解答)介绍了在 Azure 市场中创建虚拟机(VM)产品/服务时可能会遇到的常见问题。
如何将虚拟专用网络(VPN)配置为使用 VM?
如果使用 Azure 资源管理器部署模型,有三个选项:
- 使用 Azure 门户创建基于路由的 VPN 网关
- 使用 Azure PowerShell 创建基于路由的 VPN 网关
- 使用 CLI 创建基于路由的 VPN 网关
Microsoft支持策略,用于在基于 Azure 的 VM 上运行Microsoft服务器软件?
可以在 Microsoft 服务器软件支持Microsoft Azure 虚拟机中找到详细信息。
在 VM 中,如何在启动任务中管理自定义脚本扩展?
有关使用 Azure PowerShell 模块、Azure 资源管理器模板和 Windows 系统上的故障排除步骤的自定义脚本扩展的详细信息,请参阅适用于 Windows 的自定义脚本扩展。
Azure 市场中是否支持 32 位应用程序或服务?
不。 Azure VM 支持的作系统和标准服务均为 64 位。 尽管大多数 64 位作系统支持 32 位版本的应用程序以实现向后兼容性,但不支持将 32 位应用程序用作 VM 解决方案的一部分,并且强烈建议不要这样做。 以 64 位项目的形式重新创建应用程序。
有关详细信息,请参阅以下文章:
- 运行 32 位应用程序
- 对 Azure 虚拟机中 32 位作系统的支持
- Microsoft Azure 虚拟机 Microsoft服务器软件支持
错误:VHD 已注册到映像存储库作为资源
每次尝试从 VHD 创建映像时,都会在 Azure PowerShell 中收到错误“VHD 已在映像存储库中注册为资源”。 我以前没有创建任何映像,也没有在 Azure 中找到具有此名称的任何映像。 如何解决此问题?
如果从具有锁的 VHD 创建了 VM,通常会出现此问题。 确认没有从此 VHD 分配的 VM,然后重试该作。 如果此问题仍然存在,请开具支持票证。 请参阅合作伙伴中心 支持。
如何从通用 vhd 创建 VM?
准备 Azure 资源管理器模板
本部分介绍如何通过从 Azure 部署的虚拟硬盘提供作系统和数据磁盘 VHD 映像来创建和部署用户提供的虚拟机(VM)映像。 这些步骤使用通用 VHD 部署 VM。
登录到 Azure 门户。
将通用作系统 VHD 和数据磁盘 VHD 上传到 Azure 存储帐户。
在主页上,选择 创建资源。 搜索“模板部署”并选择“创建 。
在编辑器中选择“生成自己的模板”。
的选择
将以下 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'))]" } ] } } } ] }
提供显示的自定义部署属性页的参数值。
ResourceGroupName 现有的 Azure 资源组名称。 通常,使用与密钥保管库相同的 RG。 TemplateFile 文件的完整路径名 VHDtoImage.json。 userStorageAccountName 存储帐户的名称。 dnsNameForPublicIP 公共 IP 的 DNS 名称;必须为小写。 subscriptionId Azure 订阅标识符。 位置 资源组的标准 Azure 地理位置。 vmName 虚拟机的名称。 vhdUrl 虚拟硬盘的 Web 地址。 vmSize 虚拟机实例的大小。 publicIPAddressName 公共 IP 地址的名称。 virtualNetworkName 虚拟网络的名称。 nicName 虚拟网络的网络接口卡的名称。 adminUserName 管理员帐户的用户名。 adminPassword 管理员密码。 提供这些值后,请选择“购买 。
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"
如何测试隐藏的预览图像?
可以使用快速入门模板部署隐藏的预览映像。 若要部署预览映像,请执行以下作: