我正在寻找一种 powershell 方法来断开虚拟机与 OMS 工作区的连接。
我编写了一个 powershell 脚本来将虚拟机移动到其他订阅。所以我必须将此虚拟机从“源工作区”重新连接到“目标工作区”。
只需删除 OMS 扩展,虚拟机就会在 Azure 门户“Log Analytics 工作区 > 工作区数据源 > 虚拟机”中显示为“未连接”。
这个 cmdlet 应该可以解决问题(文档不太清楚),但我总是收到相同的消息
remove-AzureRmOperationalInsightsDataSource -Workspace $OmsWkspceITS -Name CentosMove
Confirm
Are you sure you want to remove data source 'CentosMove' in workspace 'itsoms'?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Yes"): yes
WARNING: DataSource 'CentosMove' does not exist in workspace 'itsoms'.
Run Code Online (Sandbox Code Playgroud)
(CentosMove 是我的虚拟机名称)。
我们的 ITSOMS 工作区已使用多年,拥有数百个虚拟机、许多解决方案、NSG 日志流分析......
$OmsWkspceITS
Name : itsoms
ResourceGroupName : rg_its_exploit
ResourceId : /subscriptions/blablabla/resourcegroups/blabla/providers/microsoft.operationalinsights/workspaces/itsoms …Run Code Online (Sandbox Code Playgroud)