2016-11-10 59 views
2

我需要根據映像(Windows Server 2016上的SQL Server 2016)創建虛擬機,並通過PowerShell爲其添加DSC擴展。我有template.json,它是我在portal中創建VM(windows2016服務器上的sql2016服務器)時保存的parameters.json文件(在參數文件中,我定義了發佈的sdc zip和admin密碼的url)。 帶有配置的Zip文件位於github公共存儲庫上。它是由powershell publish commandlet創建的。 在此之後我的下一個步驟是:無法在ARM模式下向虛擬機添加Azure DSC擴展

Login-AzureRmAccount 
# Create resource group 
New-AzureRmResourceGroup -Name orsql1 -Location 'North Europe' # succeed 

# Define deployment variables 
$Deployment = @{ 
    ResourceGroupName = 'orsqllast'; 
    Mode = 'Complete'; 
    TemplateFile = 'template.json'; 
    TemplateParameterFile = 'parameters.json'; 
    Force = $true; 
} 
New-AzureRmResourceGroupDeployment @Deployment -DeploymentDebugLogLevel All 

dsc1.ps1內容:

configuration IISInstall 
{ 
    node ("localhost") 
    { 
     WindowsFeature IIS 
     { 
      Ensure = "Present" 
      Name = "Web-Server" 
     } 
    } 
} 

大量的時間後,我得到這個錯誤:

New-AzureRmResourceGroupDeployment : 14:02:10 - Resource Microsoft.Resources/deployments 'Microsoft.DSC-20161 
010122604' failed with message '{ 
    "status": "Failed", 
    "error": { 
    "code": "ResourceDeploymentFailure", 
    "message": "The resource operation completed with terminal provisioning state 'Failed'.", 
    "details": [ 
     { 
     "code": "DeploymentFailed", 
     "message": "At least one resource deployment operation failed. Please list deployment operations for 
details. Please see https://aka.ms/arm-debug for usage details.", 
     "details": [ 
      { 
      "code": "Conflict", 
      "message": "{\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \"ResourceDeploymen 
tFailure\",\r\n \"message\": \"The resource operation completed with terminal provisioning state 'Failed'. 
\",\r\n \"details\": [\r\n  {\r\n  \"code\": \"VMExtensionProvisioningError\",\r\n  \"mess 
age\": \"VM has reported a failure when processing extension 'Microsoft.Powershell.DSC'. Error message: \\\"E 
rror unpacking 'dsc1.ps1.zip'; verify this is a valid ZIP package.\\nError details: Exception calling \\\"Ext 
ractToDirectory\\\" with \\\"2\\\" argument(s): \\\"End of Central Directory record could not be found.\\\"\\ 
\".\"\r\n  }\r\n ]\r\n }\r\n}" 
      } 
     ] 
     } 
    ] 
    } 
}' 
At line:14 char:1 
+ New-AzureRmResourceGroupDeployment @Deployment -DeploymentDebugLogLe ... 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception 
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResour 
    ceGroupDeploymentCmdlet 

New-AzureRmResourceGroupDeployment : 14:02:10 - At least one resource deployment operation failed. Please lis 
t deployment operations for details. Please see https://aka.ms/arm-debug for usage details. 
At line:14 char:1 
+ New-AzureRmResourceGroupDeployment @Deployment -DeploymentDebugLogLe ... 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception 
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResour 
    ceGroupDeploymentCmdlet 

New-AzureRmResourceGroupDeployment : 14:02:10 - Template output evaluation skipped: at least one resource dep 
loyment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug 
for usage details. 
At line:14 char:1 
+ New-AzureRmResourceGroupDeployment @Deployment -DeploymentDebugLogLe ... 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception 
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResour 
    ceGroupDeploymentCmdlet 

New-AzureRmResourceGroupDeployment : 14:02:10 - Template output evaluation skipped: at least one resource dep 
loyment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug 
for usage details. 
At line:14 char:1 
+ New-AzureRmResourceGroupDeployment @Deployment -DeploymentDebugLogLe ... 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception 
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResour 
    ceGroupDeploymentCmdlet 

的拉鍊是有效的,我使用一個 - 同樣的錯誤。 parameters.json

"ex0_vmName": { 
"value": "node1" 
}, 
"ex0_location": { 
"value": "northeurope" 
}, 
"ex0_modulesUrl": { 
"value": "https://github.com/myname/mydsc/blob/master/dsc1.ps1.zip" 
}, 
"ex0_configurationFunction": { 
"value": "dsc1.ps1\\IISInstall" 
}, 
"ex0_wmfVersion": { 
"value": "latest" 
}, 
"ex0_privacy": { 
"value": "Enable" 
}, 
"ex0_version": { 
"value": "2.8" 
} 

回答

1

的 部分我會建議你在虛擬機本身在C諮詢日誌:\ windowsazure \日誌。在c:\ extensions下(現在是C:\ Packages \ Plugins),你可以找到你的zip包和DSC擴展文件。

解決該問題的最簡單方法是使用門戶創建DSC擴展。如果它失敗並出現相同的錯誤,您將希望重新創建zip文件。我已經有了與zip包相同的錯誤,並通過重新創建解決了它們。

我也建議你轉移到Azure自動化。根據您的範圍,您可能沒有問題每月500免費分鐘,您可以將mof上傳到Azure自動化。我發現Azure Automation比DSC擴展更加一致。

+0

我提交的zip文件有效時出錯了。任何方式感謝您的幫助! ) –

+0

我告訴過你了:) – 4c74356b41

相關問題