【问题标题】:Black Desktop Background Azure VM黑色桌面背景 Azure VM
【发布时间】:2016-02-19 12:33:37
【问题描述】:

我正在我的订阅中部署 Windows Azure VM 映像,使用资源管理模板他们部署得很好,预计桌面背景是黑色的,如果我启用 BGInfo 扩展,它就不起作用。

如果我通过 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'))]"
            }
          ]
        }
      }
    }
  ],

}

我尝试过使用新模板,结果相同,有什么想法吗?

【问题讨论】:

  • 能否附上黑色桌面背景 Azure VM 的屏幕截图?
  • 您要配置哪种类型的 VM?例如 Windows Server 2012 R2
  • 尝试提供 2012 R2
  • 原来是组策略问题

标签: azure azure-virtual-machine azure-resource-manager


【解决方案1】:

在模板中您没有定义 bgInfoExtension。如果您在模板中将其定义为“Microsoft.Compute/virtualMachines”下的资源,它将在您部署模板时自动部署。

BGInfo 扩展 ARM 模板 sn-p 示例:

"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
    }
}]

【讨论】:

  • 谢谢。我正在通过 powershell 部署扩展: Set-AzureRmVMExtension -ExtensionName BGInfo -Publisher Microsoft.Compute -Version 2.1 -ExtensionType BGInfo -Location $location -ResourceGroupName $RG -VMName $vmName -Verbose
  • 我们需要这个扩展来改变黑色背景吗?
猜你喜欢
  • 2014-01-30
  • 1970-01-01
  • 2020-04-23
  • 2013-04-16
  • 2013-04-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多