Powershell 自动化帐户已链接到Azure工作区
我正在尝试删除Microsoft Azure中的自动化帐户 当我运行下面的命令时,我得到以下错误:Powershell 自动化帐户已链接到Azure工作区,powershell,azure,automation,account,Powershell,Azure,Automation,Account,我正在尝试删除Microsoft Azure中的自动化帐户 当我运行下面的命令时,我得到以下错误: Remove-AzureRmResource -ResourceGroupName changed_resource_group_name -ResourceType Microsoft.Automation/automationAccounts -ResourceName changed_resource_name ApiVersion 2015-10-31 -Force 我得到以下错误: {
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/...."
}
有人知道如何解决这个问题吗 也有这样的指导,但在一月份它“即将到来”:
来源:根据您的描述,您需要取消自动化帐户与workspace的链接。你可以在Azure门户上完成 更多信息请参考此
完成此操作后,您可以删除您的自动化帐户。如果您正在使用链接到工作区的自动化帐户,则需要首先删除OMS中使用自动化帐户的解决方案
$automationSolutions = "Updates", "ChangeTracking", "AzureAutomation"
$enabledautomationSolutions = (Get-AzureRmOperationalInsightsIntelligencePacks -ResourceGroupName $workspace.ResourceGroupName -WorkspaceName $workspace.Name).Where({$_.Name -in $AutomationSolutions -and $_.Enabled -eq $true})
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 Automation帐户的资源ID并将其删除:
$automationAccount = Get-AzureRmResource -ResourceId ($workspace.ResourceId + "/linkedServices/automation") -ErrorAction Stop
Remove-AzureRmResource -ResourceId $automationAccount.ResourceId
MSDN网站对此有一个解决方案。请点击以下链接:
希望这有帮助。这有帮助吗?不,马克,这个脚本不起作用!但我只想删除自动化帐户,其他什么都不想。我想把其他一切都放在我的答案上。