@@ -143,4 +143,71 @@ function Test-WorkspaceActions
143
143
Assert-NotNull $usages [0 ].NextResetTime
144
144
Assert-AreEqual " Bytes" $usages [0 ].Unit
145
145
Assert-AreEqual ([Timespan ]::FromDays(1 )) $usages [0 ].QuotaPeriod
146
+ }
147
+
148
+ <#
149
+ . SYNOPSIS
150
+ Enable, disable, and list intelligence packs and verify the results
151
+ #>
152
+ function Test-WorkspaceEnableDisableListIntelligencePacks
153
+ {
154
+
155
+ $wsname = Get-ResourceName
156
+ $rgname = Get-ResourceGroupName
157
+ $wslocation = Get-ProviderLocation
158
+
159
+ New-AzureRmResourceGroup - Name $rgname - Location $wslocation - Force
160
+
161
+ # Create and get a workspace
162
+ $workspace = New-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name $wsname - Location $wslocation - Sku free - Tags @ {" tag1" = " val1" } - Force
163
+ Assert-AreEqual $rgname $workspace.ResourceGroupName
164
+ Assert-AreEqual $wsname $workspace.Name
165
+ Assert-AreEqual $wslocation $workspace.Location
166
+ Assert-AreEqual " free" $workspace.Sku
167
+ Assert-NotNull $workspace.ResourceId
168
+ Assert-AreEqual 1 $workspace.Tags.Count
169
+ Assert-NotNull $workspace.CustomerId
170
+ Assert-NotNull $workspace.PortalUrl
171
+
172
+ # Enable intelligence packs
173
+ Set-AzureRmOperationalInsightsIntelligencePack - ResourceGroupName $rgname - WorkspaceName $wsname - IntelligencePackName " ChangeTracking" - Enabled $true
174
+ Set-AzureRmOperationalInsightsIntelligencePack - ResourceGroupName $rgname - WorkspaceName $wsname - IntelligencePackName " SiteRecovery" - Enabled $true
175
+
176
+ # List to verify that the IP's have been enabled
177
+ $ipList = Get-AzureRmOperationalInsightsIntelligencePacks - ResourceGroupName $rgname - WorkspaceName $wsname
178
+ Foreach ($ip in $ipList )
179
+ {
180
+ if (($ip.Name -eq " ChangeTracking" ) -or ($ip.Name -eq " SiteRecovery" ) -or ($ip.Name -eq " LogManagement" ))
181
+ {
182
+ Assert-True $ip.Enabled
183
+ }
184
+ else
185
+ {
186
+ Assert-False $ip.Enabled
187
+ }
188
+ }
189
+
190
+ # Disable intelligence packs
191
+ Set-AzureRmOperationalInsightsIntelligencePack - ResourceGroupName $rgname - WorkspaceName $wsname - IntelligencePackName " ChangeTracking" - Enabled $false
192
+ Set-AzureRmOperationalInsightsIntelligencePack - ResourceGroupName $rgname - WorkspaceName $wsname - IntelligencePackName " SiteRecovery" - Enabled $false
193
+
194
+ # List to verify that the IP's have been disabled
195
+ $ipList = Get-AzureRmOperationalInsightsIntelligencePacks - ResourceGroupName $rgname - WorkspaceName $wsname
196
+ Foreach ($ip in $ipList )
197
+ {
198
+ if ($ip.Name -eq " LogManagement" )
199
+ {
200
+ Assert-True $ip.Enabled
201
+ }
202
+ else
203
+ {
204
+ Assert-False $ip.Enabled
205
+ }
206
+ }
207
+
208
+ # Delete the original workspace via piping
209
+ $workspace | Remove-AzureRmOperationalInsightsWorkspace - Force
210
+ $workspaces = Get-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname
211
+ Assert-AreEqual 0 $workspaces.Count
212
+ Assert-ThrowsContains { Get-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name wsname } " ResourceNotFound"
146
213
}
0 commit comments