2016-11-10 3 views
2

Мне нужно создать виртуальную машину на основе образа (SQL Server 2016 на Windows Server 2016) и добавить расширение DSC к ней с помощью powershell. У меня есть template.json и его файлы parameters.json, которые я сохранил при создании VM (сервер sql2016 на сервере Windows 2016) на портале (в файле параметров я определяю url, где публикуется sdc zip и пароль администратора). Zip-файл с конфигурацией находится в публичном репозитории github. И он был создан командой powershell publish commandlet. После этого моих следующих шагов:Невозможно добавить расширение Azure DSC для виртуальной машины в режиме ARM

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

Я хотел бы предложить вам проконсультироваться журналы в самой VM в C: \ \ windowsazure журналы. В разделе c: \ extensions (теперь C: \ Packages \ Plugins) вы можете найти свой zip-пакет и файлы расширения DSC.

Самый простой способ устранения неполадок - это создать расширение DSC с помощью портала. Если сбой произошел с той же ошибкой, вы захотите воссоздать zip-файл. У меня были те же ошибки с пакетом zip и они были решены путем их воссоздания.

Я также предлагаю вам перейти на Azure Automation. В зависимости от вашего объема, вы можете быть в порядке 500 бесплатных минут в месяц, и вы можете загрузить mof's в Azure Automation. И я обнаружил, что Azure Automation намного более последовательна, чем расширение DSC.

+0

Я был неправ, когда был представлен этот почтовый индекс. В любом случае спасибо за помощь!) –

+0

Я сказал вам :) – 4c74356b41