【问题标题】:Automation account is linked to a workspace Azure自动化帐户已链接到工作区 Azure
【发布时间】:2017-05-10 14:20:25
【问题描述】:

我正在尝试删除 Microsoft Azure 中的自动化帐户。

当我在下面运行这个命令时,我得到下面的错误:

Remove-AzureRmResource -ResourceGroupName changed_resource_group_name -ResourceType Microsoft.Automation/automationAccounts -ResourceName changed_resource_name ApiVersion 2015-10-31 -Force

我收到以下错误:

{
  "code": "Conflict",
  "message": "Automation account is linked to a workspace. SubscriptionId: changed_subscription_id AccountName: changed_automation_ac_name WorkspaceId: /subscriptions/...../providers/microsoft.operationalinsights/workspaces/...."
}

有人知道如何解决这个问题吗?

【问题讨论】:

标签: powershell azure automation account


【解决方案1】:

根据您的描述,您需要取消您的自动化帐户与工作区的关联。您可以在 Azure 门户上执行此操作。

更多信息请参考这个link

完成后,您可以删除您的自动化帐户。

【讨论】:

    【解决方案2】:

    如果您使用链接到工作区的自动化帐户,您需要先删除 OMS 中使用自动化帐户的解决方案。

    Azure 自动化、变更跟踪和更新是使用自动化帐户的解决方案。

    $automationSolutions = "Updates", "ChangeTracking", "AzureAutomation"
    
    $enabledautomationSolutions = (Get-AzureRmOperationalInsightsIntelligencePacks -ResourceGroupName $workspace.ResourceGroupName -WorkspaceName $workspace.Name).Where({$_.Name -in $AutomationSolutions -and $_.Enabled -eq $true})
    

    现在删除每个解决方案:

    foreach ($soln in $enabledAutomationSolutions.Name) {
            Set-AzureRmOperationalInsightsIntelligencePack -ResourceGroupName $workspace.ResourceGroupName -WorkspaceName $workspace.Name -IntelligencePackName $soln -Enabled $false
        }
    

    之后,您可以获取 Azure 自动化帐户的 Resource ID 并将其删除:

    $automationAccount = Get-AzureRmResource -ResourceId ($workspace.ResourceId + "/linkedServices/automation") -ErrorAction Stop
    
    Remove-AzureRmResource -ResourceId $automationAccount.ResourceId
    

    MSDN 网站对此有解决方案。请点击以下链接:

    MSDN - How to unlink an automation account that is linked to an OMS workspace?

    希望这会有所帮助。

    【讨论】:

      【解决方案3】:

      也有这个指导,但在一月份它“即将推出”:

      1. 导航到链接到工作区的自动化帐户
      2. 选择概览节点
      3. 单击取消链接工作区命令(当前不可用 并且工具提示显示“即将推出”)

      来源:https://social.msdn.microsoft.com/Forums/en-US/cb158610-a065-4cb9-b302-6230de5ca434/how-to-unlink-an-automation-account-that-is-linked-to-an-oms-workspace?forum=opinsights

      【讨论】:

      • 但我只想删除自动化帐户,没有别的。我想保留其他所有内容
      • 修改了我的答案。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-01-19
      • 2021-06-07
      • 1970-01-01
      • 1970-01-01
      • 2019-01-26
      • 1970-01-01
      • 2021-06-21
      相关资源
      最近更新 更多