Remove-AzureRmResource 请求的资源不支持http方法'DELETE'
Remove-AzureRmResource The requested resource does not support http method 'DELETE'
好的 - 我有一个奇怪的.....
我已经使用以下代码通过 ARM 模板部署了编译作业:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"compile-settings": {
"type": "object",
"metadata": {
"description": "These are settings for a DSC Compile"
}
},
"tag-values": {
"type": "object",
"metadata": {
"description": "These are the Tag values"
}
}
},
"resources": [
{
"name": "[parameters('compile-settings').name]",
"type": "Microsoft.Automation/automationAccounts/compilationjobs",
"apiVersion": "2015-10-31",
"location": "Australia Southeast",
"tags": "[parameters('tag-values')]",
"dependsOn": [],
"properties": {
"configuration": "[parameters('compile-settings').configuration]",
"parameters": "[parameters('compile-settings').parameters]"
},
"resources": []
}
],
"outputs": {}
}
因为我现在正在开发中。当我重新 运行 部署时,出现以下错误:
{
"code": "Conflict",
"message": "Job with specified id already exists. Job id: cde3eb0e-e8e4-de3e-0eae-e4cde3eb0eae"
}
使用 resources.azure.com,我找不到这个资源,但我可以在使用 PowerShell 时找到它,例如
Get-AzureRmResource -ResourceId "/subscriptions/{subscriptionId}/resourceGroups/rg-au-901/providers/Microsoft.Automation/automationAccounts/aa-au-901/compilationjobs/cde3eb0e-e8e4-de3e-0eae-e4cde3eb0eae" -ApiVersion "2015-10-31"
结果:
ResourceId : /subscriptions/{subscriptionId}/resourceGroups/rg-au-901/providers/Microsoft.Automation/automationAccounts/aa-au-901/compilationjobs/cde3eb0e-e8e4-de3e-0eae-e4cde3eb0eae
ResourceName : aa-au-901/cde3eb0e-e8e4-de3e-0eae-e4cde3eb0eae
ResourceType : Microsoft.Automation/automationAccounts/compilationjobs
ResourceGroupName : rg-au-901
SubscriptionId : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Properties : @{jobId=cde3eb0e-e8e4-de3e-0eae-e4cde3eb0eae; creationTime=2017-07-16T08:27:13.457+00:00; provisioningState=Suspended;
status=Suspended; statusDetails=None; startTime=2017-07-16T08:28:01.74+00:00; endTime=;
lastModifiedTime=2017-07-16T08:28:13.85+00:00; lastStatusModifiedTime=2017-07-16T08:28:13.85+00:00; exception=The running
command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: The term
'xStorage\xWaitforDisk' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.; parameters=; configuration=;
runOn=; newNodeConfigurationBuildVersionRequired=False}
但是,当我尝试使用带有 Force 参数的 Remove-AzureRmResource 删除它时,它失败了:
Remove-AzureRmResource : The pipeline has been stopped.
At line:1 char:1
+ Remove-AzureRmResource -ResourceId "/subscriptions/xxxxxxxx-xxxx-xxxx ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Remove-AzureRmResource], PipelineStoppedException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.RemoveAzureResourceCmdlet
Remove-AzureRmResource : {"code":"MethodNotAllowed","message":"{\"Message\":\"The requested resource does not support http method 'DELETE'.\"}"}
At line:1 char:1
+ Remove-AzureRmResource -ResourceId "/subscriptions/xxxxxxxx-xxxx-xxxx ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Remove-AzureRmResource], ErrorResponseMessageException
+ FullyQualifiedErrorId : MethodNotAllowed,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.RemoveAzureResourceCmdlet
帮忙?
您可以通过 powershell 步骤来解决这个问题以生成 GUID,或者可以省略 GUID 以便它自己生成一个。
此外,还有一个 powershell cmdlet 可以启动编译作业,不需要 guid。
Start-AzureRmAutomationDscCompilationJob
据我所知,您无法删除 CompilationJob。当您再次执行该作业时,它将重新生成一个不同的作业 ID。您可以使用以下命令重新运行 Compilation Job
Start-AzureRmAutomationDscCompilationJob -ResourceGroupName "shui" -AutomationAccountName "shuitest" -ConfigurationName "dscDomainJoin"
更多信息请参考此link。
如果您想删除所有作业,您需要删除您的 DSC 配置。
其实我发布的答案是在错误中。如果相同的 GUID 已经存在,那么我有一个逻辑问题。
我发现我没有将父部署名称(始终不同)传递给子部署,并且 ARM 模板中的唯一字符串函数没有生成 'Unique' GUID。
父模板中的资源现在包含以下代码:
"name": "[concat('dscCompile-', toLower(uniqueString(deployment().name)))]"
子模板使用一个变量,然后连接起来创建一个唯一字符串以生成 GUID。
"deployment": "[concat('-', toLower(uniqueString(deployment().name)))]"
"name": "[concat('newGuid', copyIndex(), variables('deployment'))]",
感谢所有提供帮助和建议的人!
好的 - 我有一个奇怪的.....
我已经使用以下代码通过 ARM 模板部署了编译作业:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"compile-settings": {
"type": "object",
"metadata": {
"description": "These are settings for a DSC Compile"
}
},
"tag-values": {
"type": "object",
"metadata": {
"description": "These are the Tag values"
}
}
},
"resources": [
{
"name": "[parameters('compile-settings').name]",
"type": "Microsoft.Automation/automationAccounts/compilationjobs",
"apiVersion": "2015-10-31",
"location": "Australia Southeast",
"tags": "[parameters('tag-values')]",
"dependsOn": [],
"properties": {
"configuration": "[parameters('compile-settings').configuration]",
"parameters": "[parameters('compile-settings').parameters]"
},
"resources": []
}
],
"outputs": {}
}
因为我现在正在开发中。当我重新 运行 部署时,出现以下错误:
{ "code": "Conflict", "message": "Job with specified id already exists. Job id: cde3eb0e-e8e4-de3e-0eae-e4cde3eb0eae" }
使用 resources.azure.com,我找不到这个资源,但我可以在使用 PowerShell 时找到它,例如
Get-AzureRmResource -ResourceId "/subscriptions/{subscriptionId}/resourceGroups/rg-au-901/providers/Microsoft.Automation/automationAccounts/aa-au-901/compilationjobs/cde3eb0e-e8e4-de3e-0eae-e4cde3eb0eae" -ApiVersion "2015-10-31"
结果:
ResourceId : /subscriptions/{subscriptionId}/resourceGroups/rg-au-901/providers/Microsoft.Automation/automationAccounts/aa-au-901/compilationjobs/cde3eb0e-e8e4-de3e-0eae-e4cde3eb0eae ResourceName : aa-au-901/cde3eb0e-e8e4-de3e-0eae-e4cde3eb0eae ResourceType : Microsoft.Automation/automationAccounts/compilationjobs ResourceGroupName : rg-au-901 SubscriptionId : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx Properties : @{jobId=cde3eb0e-e8e4-de3e-0eae-e4cde3eb0eae; creationTime=2017-07-16T08:27:13.457+00:00; provisioningState=Suspended; status=Suspended; statusDetails=None; startTime=2017-07-16T08:28:01.74+00:00; endTime=; lastModifiedTime=2017-07-16T08:28:13.85+00:00; lastStatusModifiedTime=2017-07-16T08:28:13.85+00:00; exception=The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: The term 'xStorage\xWaitforDisk' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.; parameters=; configuration=; runOn=; newNodeConfigurationBuildVersionRequired=False}
但是,当我尝试使用带有 Force 参数的 Remove-AzureRmResource 删除它时,它失败了:
Remove-AzureRmResource : The pipeline has been stopped. At line:1 char:1 + Remove-AzureRmResource -ResourceId "/subscriptions/xxxxxxxx-xxxx-xxxx ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Remove-AzureRmResource], PipelineStoppedException + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.RemoveAzureResourceCmdlet Remove-AzureRmResource : {"code":"MethodNotAllowed","message":"{\"Message\":\"The requested resource does not support http method 'DELETE'.\"}"} At line:1 char:1 + Remove-AzureRmResource -ResourceId "/subscriptions/xxxxxxxx-xxxx-xxxx ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Remove-AzureRmResource], ErrorResponseMessageException + FullyQualifiedErrorId : MethodNotAllowed,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.RemoveAzureResourceCmdlet
帮忙?
您可以通过 powershell 步骤来解决这个问题以生成 GUID,或者可以省略 GUID 以便它自己生成一个。
此外,还有一个 powershell cmdlet 可以启动编译作业,不需要 guid。
Start-AzureRmAutomationDscCompilationJob
据我所知,您无法删除 CompilationJob。当您再次执行该作业时,它将重新生成一个不同的作业 ID。您可以使用以下命令重新运行 Compilation Job
Start-AzureRmAutomationDscCompilationJob -ResourceGroupName "shui" -AutomationAccountName "shuitest" -ConfigurationName "dscDomainJoin"
更多信息请参考此link。
如果您想删除所有作业,您需要删除您的 DSC 配置。
其实我发布的答案是在错误中。如果相同的 GUID 已经存在,那么我有一个逻辑问题。
我发现我没有将父部署名称(始终不同)传递给子部署,并且 ARM 模板中的唯一字符串函数没有生成 'Unique' GUID。
父模板中的资源现在包含以下代码:
"name": "[concat('dscCompile-', toLower(uniqueString(deployment().name)))]"
子模板使用一个变量,然后连接起来创建一个唯一字符串以生成 GUID。
"deployment": "[concat('-', toLower(uniqueString(deployment().name)))]"
"name": "[concat('newGuid', copyIndex(), variables('deployment'))]",
感谢所有提供帮助和建议的人!