azure - Remove-AzureRmResource 请求的资源不支持http方法 'DELETE'

标签 azure azure-rm-template

好吧 - 我有一个奇怪的......

我已使用以下代码通过 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,以便它自己生成一个 GUID。

此外,还有一个 powershell cmdlet 可以启动编译作业,不需要 guid。

Start-AzureRmAutomationDscCompilationJob

关于azure - Remove-AzureRmResource 请求的资源不支持http方法 'DELETE',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45128639/

相关文章:

azure - 逻辑应用程序是否支持具有随机增量的指数回退

python - azure-sdk-for-python : get the LUN of a disk

python - Azure WebJob 与 Django 中的环境变量

Azure AD Multi-Tenancy 应用程序

azure - 使用 ARM 模板从头开始重新部署 azure web 应用程序会导致 404 网站未找到

azure - ARM 模板部署 - 由于与并发请求错误冲突,请求失败

azure - 逻辑应用消费 API 连接 - ARM 模板函数

Azure混合连接 "No such host is known"

azure - 更新 Azure 容器实例中的 docker 镜像

azure - Azure Function 的 ARM 模板忽略 preWarmedInstanceCount 设置