我需要根據映像(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"
}
我提交的zip文件有效時出錯了。任何方式感謝您的幫助! ) –
我告訴過你了:) – 4c74356b41