黑色桌面背景Azure虚拟机
问题描述:
我在我的订阅中部署Windows Azure虚拟机映像,使用它们部署的资源管理模板正常,期望桌面背景为黑色,并且如果启用BGInfo扩展,则不起作用。黑色桌面背景Azure虚拟机
如果我通过Azure门户部署相同类型的图像,桌面背景是正确的(Windows ServerBG),并且BGInfo按预期工作。
这是模板,我使用:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters":
{
"location":
{
"type": "string",
"defaultValue": "North Europe",
"allowedValues":
[
"West US",
"East US",
"West Europe",
"East Asia",
"Southeast Asia",
"North Europe"
],
"metadata":
{
"description": "Location of resources"
}
},
"StorageAccount":
{
"type": "string",
"metadata":
{
"description": "Storage Account Name"
}
},
"storageAccountType":
{
"type": "string",
"defaultValue": "Standard_LRS",
"metadata":
{
"description": "Type of the Storage Account"
}
},
"privateIPAddressType":
{
"type": "string",
"defaultValue": "Static",
"allowedValues":
[
"Dynamic",
"Static"
],
"metadata":
{
"description": "Private IP Address Type"
}
},
"privateIPAddress":
{
"type": "string",
"metadata":
{
"description": "Private IP Address"
}
},
"vmName":
{
"type": "string",
"metadata":
{
"description": "Name of the VM"
}
},
"vmSize":
{
"type": "string",
"defaultValue": "Standard_D2",
"metadata":
{
"description": "Size of the VM"
}
},
"imagePublisher":
{
"type": "string",
"defaultValue": "MicrosoftWindowsServer",
"metadata":
{
"description": "Image Publisher"
}
},
"imageOffer":
{
"type": "string",
"defaultValue": "WindowsServer",
"metadata":
{
"description": "Image Offer"
}
},
"imageSKU":
{
"type": "string",
"defaultValue": "2012-R2-Datacenter",
"metadata":
{
"description": "Image SKU"
}
},
"adminUsername":
{
"type": "string",
"metadata":
{
"description": "Admin username"
}
},
"adminPassword":
{
"type": "securestring",
"metadata":
{
"description": "Admin password"
}
},
"existingVNETName":
{
"type": "string",
"metadata":
{
"description": "Existing VNET that contains the domain controller"
}
},
"existingSubnetName":
{
"type": "string",
"metadata":
{
"description": "Existing subnet that contains the domain controller"
}
},
"existingVirtualNetworkResourceGroup":
{
"type": "string",
"metadata":
{
"description": "Name of the existing VNET resource group"
}
}
},
"variables":
{
"api-version": "2015-05-01-preview",
"vnetID": "[resourceId(parameters('existingVirtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', parameters('existingVNETName'))]",
"subnet1Ref": "[concat(variables('vnetID'),'/subnets/',parameters('existingSubnetName'))]",
"privateNicName": "[concat(parameters('vmName'),'-Production')]",
"NewStorageAccount": "[concat(parameters('vmName'), parameters('StorageAccount'))]",
"OSDisk": "[concat(parameters('vmName'),'-OSDisk')]",
"DataDisk": "[concat(parameters('vmName'),'-DataDisk')]"
},
"resources":
[
{
"apiVersion": "[variables('api-version')]",
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('NewStorageAccount')]",
"location": "[parameters('location')]",
"properties":
{
"accountType": "[parameters('storageAccountType')]"
}
},
{
"apiVersion": "[variables('api-version')]",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('privateNicName')]",
"location": "[parameters('location')]",
"tags":
{
"displayName": "NetworkInterface"
},
"properties":
{
"ipConfigurations":
[
{
"name": "ipconfig",
"properties":
{
"privateIPAllocationMethod": "[parameters('privateIPAddressType')]",
"privateIPAddress": "[parameters('privateIPAddress')]",
"subnet":
{
"id": "[variables('subnet1Ref')]"
}
}
}
]
}
},
{
"apiVersion": "[variables('api-version')]",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('vmName')]",
"location": "[parameters('location')]",
"tags":
{
"displayName": "VirtualMachine"
},
"dependsOn":
[
"[concat('Microsoft.Storage/storageAccounts/', variables('newStorageAccount'))]",
"[concat('Microsoft.Network/networkInterfaces/', variables('privateNicName'))]"
],
"properties":
{
"hardwareProfile":
{
"vmSize": "[parameters('vmSize')]"
},
"osProfile":
{
"computerName": "[parameters('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"storageProfile":
{
"imageReference":
{
"publisher": "[parameters('imagePublisher')]",
"offer": "[parameters('imageOffer')]",
"sku": "[parameters('imageSKU')]",
"version": "latest"
},
"osDisk":
{
"name": "[concat(parameters('vmName'),'-os')]",
"vhd":
{
"uri": "[concat('http://',variables('newStorageAccount'),'.blob.core.windows.net/vhds/',variables('OSDisk'),'.vhd')]"
},
"caching": "ReadWrite",
"createOption": "FromImage"
},
"dataDisks":
[
{
"name": "[concat(parameters('vmName'),'-data')]",
"vhd":
{
"Uri": "[concat('http://',parameters('vmName'), parameters('StorageAccount'),'.blob.core.windows.net/vhds/',variables('dataDisk'),'.vhd')]"
},
"caching": "None",
"createOption": "Empty",
"diskSizeGB": "100",
"lun": 0
}
]
},
"networkProfile":
{
"networkInterfaces":
[
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('privateNicName'))]"
}
]
}
}
}
],
}
我曾尝试使用新的模板,具有相同的结果,任何想法?
答
在模板中,您没有定义bgInfoExtension。如果您在模板中将其定义为“Microsoft.Compute/virtualMachines”下的资源,它将在部署模板时自动部署。
例BGInfo扩展ARM模板片段:
"resources": [{
"name": "bgInfoExt",
"type": "extensions",
"apiVersion": "[variables('api-version')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"
],
"properties": {
"publisher": "Microsoft.Compute",
"type": "BGInfo",
"typeHandlerVersion": "2.1",
"settings": { },
"protectedSettings": null,
"autoUpgradeMinorVersion": true
}
}]
+0
感谢您的支持。我通过PowerShell部署扩展: Set-AzureRmVMExtension -ExtensionName BGInfo -Publisher Microsoft.Compute -Version 2.1 -ExtensionType BGInfo -Location $ location -ResourceGroupName $ RG -VMName $ vmName -Verbose – user989384
您能附上黑色桌面背景天青VM的屏幕截图? – juvchan
http://imgur.com/gxPDGlf – user989384
你试图提供什么样的虚拟机?例如Windows Server 2012 R2 – juvchan