OK you can move #MSOMS workspaces between subscriptions – state of the art


The way we can buy Azure consumption is articulating more and more every day. With plenty of choices arise the need for Azure users to revise their billing plans and sometimes move from one plan to another. When this happens it is often the case new subscriptions get created and resources need to be moved between subscriptions.

Log Analytics workspaces can be moved between subscriptions, but there are still some caveats to be aware of:

  • all the solutions must be deleted before moving the workspace and added back after the move
  • any reference to external resources (automation accounts, O365, …) must be removed as well

Removing the solutions

While it is easy to do, you can do it via the azure portal or powershell, there are few implications you must know about:

  • even if you remove the solution, the data is retained in your workspace. And this is good.
  • you may experiment a disruption in your data collection. When you remove a solution it gets removed from your agents, this means they stop ingesting data. When you add the solution back the ingestion starts again. Based on how the solution is engineered you may lose some data during this time window.
  • when you re-add the solution the pricing plan can change. For example when you add the security solution the plan gets forced to OMS/per node. If this was not your previous plan, for example you were on the Premium plan, you must open a support ticket to get your pricing plan back

Removing references to external resources

This one shouldn’t be tricky at all, once you have removed the solutions you should not have anymore linked resources. It happened to me this is not always the case. When this happens the move fails with a generic “Conflict” error. Given the way the REST provider for Log Analytics is developed there’s no easy way to find all the references if not by trial and error and navigating in the OMS portal. In my specific case a zombie automation account (an automation account that was linked to the workspace and then deleted) was causing the conflict error. Thanks to Brian from the support people in UK we’ve been able to get rid of it with a few powershell lines. BEWARE the snippet DELETES the automation account associated with the workspace, if you’re not sure of what you’re doing open a support ticket.

Login-AzureRmAccount

Get-AzureRmSubscription | Out-GridView -OutputMode Single | Select-AzureRmSubscription

$workspace=Get-AzureRmOperationalInsightsWorkspace | out-gridview -OutputMode Single

$automationSolutions = "Updates", "ChangeTracking", "AzureAutomation"
$automationAccount = ""

# If there is a linked automation account, remove the Automation and Control solutions
# unlink the automation account
try {
$automationAccount = Get-AzureRmResource -ResourceId ($workspace.ResourceId + "/linkedServices/automation") -ErrorAction Stop
}
catch {
# continue
}

if ( $automationAccount ) {
$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
}
Remove-AzureRmResource -ResourceId $automationAccount.ResourceId
}

I’ll keep this post updated on any new development on the subject.

Advertisements
  1. #1 by Sara on September 18, 2017 - 11:54 am

    Hey there, thank you for this very useful article. I’m runnning actually into the same scenario. I just migrated my OMS workspace to another subscprion. But I noticed that even if in the Azure Portal the OMS workspace is related to the new subscription. When I go to the OMS workspace itself, then to setting >>accounts>> azure subscription and data plan > I still see that the workspace is still related to old subscription. So when I try to add the solutions to my workspace it fails as the old subscription has expired.

    • #2 by Daniele Grandini on September 19, 2017 - 7:23 am

      Hi Sara,
      actually it seems to me your issue is different from mine. In my case the migration never completed, in your case it seems it has complete, but some metadata is still referring to the old subscription. As far as I know there’s nothing you can do except opening a support ticket. I’m curious to know what happened, if they share it with you and you are so kind to share with me…

      Ciao
      Daniele

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: