2016-02-19 96 views
0

我在我的訂閱中部署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'))]" 
      } 
      ] 
     } 
     } 
    } 
    ], 

} 

我曾嘗試使用新的模板,具有相同的結果,任何想法?

+0

您能附上黑色桌面背景天青VM的屏幕截圖? – juvchan

+0

http://imgur.com/gxPDGlf – user989384

+0

你試圖提供什麼樣的虛擬機?例如Windows Server 2012 R2 – juvchan

回答

0

在模板中,您沒有定義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