@@ -25,11 +25,13 @@ function Test-WorkspaceCreateUpdateDelete
25
25
New-AzureRmResourceGroup - Name $rgname - Location $wslocation - Force
26
26
27
27
# Create and get a workspace
28
- $workspace = New-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name $wsname - Location $wslocation - Sku free - Tags @ {" tag1" = " val1" } - Force
28
+ $workspace = New-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name $wsname - Location $wslocation - Sku " STANDARD " - Tags @ {" tag1" = " val1" } - Force
29
29
Assert-AreEqual $rgname $workspace.ResourceGroupName
30
30
Assert-AreEqual $wsname $workspace.Name
31
31
Assert-AreEqual $wslocation $workspace.Location
32
- Assert-AreEqual " free" $workspace.Sku
32
+ Assert-AreEqual " STANDARD" $workspace.Sku
33
+ # if no value for RetentionInDays is specified, use the default value for the sku. For standard, the default is 30.
34
+ Assert-AreEqual 30 $workspace.RetentionInDays
33
35
Assert-NotNull $workspace.ResourceId
34
36
Assert-AreEqual 1 $workspace.Tags.Count
35
37
Assert-NotNull $workspace.CustomerId
@@ -39,33 +41,34 @@ function Test-WorkspaceCreateUpdateDelete
39
41
Assert-AreEqual $rgname $workspace.ResourceGroupName
40
42
Assert-AreEqual $wsname $workspace.Name
41
43
Assert-AreEqual $wslocation $workspace.Location
42
- Assert-AreEqual " free" $workspace.Sku
44
+ Assert-AreEqual " STANDARD" $workspace.Sku
45
+ Assert-AreEqual 30 $workspace.RetentionInDays
43
46
Assert-NotNull $workspace.ResourceId
44
47
Assert-AreEqual 1 $workspace.Tags.Count
45
48
Assert-NotNull $workspace.CustomerId
46
49
Assert-NotNull $workspace.PortalUrl
47
50
48
51
# Create a second workspace for list testing
49
52
$wstwoname = Get-ResourceName
50
- $workspacetwo = New-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name $wstwoname - Location $wslocation - Force
51
-
53
+ $workspacetwo = New-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name $wstwoname - Location $wslocation - Sku " PerNode" - RetentionInDays 60 - Force
54
+
55
+ $workspacetwo = Get-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name $wstwoname
56
+ Assert-AreEqual 60 $workspacetwo.RetentionInDays
57
+
52
58
# List the workspaces in the subscription
53
59
$workspaces = Get-AzureRmOperationalInsightsWorkspace
54
- Assert-AreEqual 2 $workspaces.Count
55
60
Assert-AreEqual 1 ($workspaces | Where {$_.Name -eq $wsname }).Count
56
61
Assert-AreEqual 1 ($workspaces | Where {$_.Name -eq $wstwoname }).Count
57
62
58
63
# List the workspaces in the resource group
59
64
$workspaces = Get-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname
60
- Assert-AreEqual 2 $workspaces.Count
61
65
Assert-AreEqual 1 ($workspaces | Where {$_.Name -eq $wsname }).Count
62
66
Assert-AreEqual 1 ($workspaces | Where {$_.Name -eq $wstwoname }).Count
63
67
64
68
# Delete the second workspace
65
69
Remove-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgName - Name $wstwoname - Force
66
- Assert-ThrowsContains { Get-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name $wstwoname } " ResourceNotFound "
70
+ Assert-ThrowsContains { Get-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name $wstwoname } " NotFound "
67
71
$workspaces = Get-AzureRmOperationalInsightsWorkspace
68
- Assert-AreEqual 1 $workspaces.Count
69
72
Assert-AreEqual 1 ($workspaces | Where {$_.Name -eq $wsname }).Count
70
73
Assert-AreEqual 0 ($workspaces | Where {$_.Name -eq $wstwoname }).Count
71
74
@@ -76,17 +79,18 @@ function Test-WorkspaceCreateUpdateDelete
76
79
$workspace = $workspace | New-AzureRmOperationalInsightsWorkspace - Tags @ {" foo" = " bar" } - Force
77
80
Assert-AreEqual 1 $workspace.Tags.Count
78
81
79
- # Clear the tags and update the sku via piping
80
- $workspace | Set-AzureRmOperationalInsightsWorkspace - Tags @ {} - Sku standard
82
+ # Clear the tags and update the sku, RetentionInDays via piping
83
+ $workspace | Set-AzureRmOperationalInsightsWorkspace - Tags @ {} - Sku standalone - RetentionInDays 123
81
84
$workspace = Get-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name $wsname
82
85
Assert-AreEqual 0 $workspace.Tags.Count
83
- Assert-AreEqual standard $workspace.Sku
86
+ Assert-AreEqual standalone $workspace.Sku
87
+ Assert-AreEqual 123 $workspace.RetentionInDays
84
88
85
89
# Delete the original workspace via piping
86
90
$workspace | Remove-AzureRmOperationalInsightsWorkspace - Force
87
91
$workspaces = Get-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname
88
92
Assert-AreEqual 0 $workspaces.Count
89
- Assert-ThrowsContains { Get-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name wsname } " ResourceNotFound "
93
+ Assert-ThrowsContains { Get-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name wsname } " NotFound "
90
94
}
91
95
92
96
<#
@@ -106,7 +110,7 @@ function Test-WorkspaceActions
106
110
Assert-AreEqual 0 $accounts.Count
107
111
108
112
# Attempt to link a workspace to an invalid account
109
- Assert-ThrowsContains { New-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name $wsname - Location $wslocation - CustomerId ([guid ]::NewGuid()) } " not a valid link target "
113
+ Assert-ThrowsContains { New-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name $wsname - Location $wslocation - Sku " STANDARD " - CustomerId ([guid ]::NewGuid()) } " BadRequest "
110
114
111
115
# Create a real workspace for use in the rest of the test
112
116
$workspace = New-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name $wsname - Location $wslocation - Sku " STANDARD" - Tags @ {" tag1" = " val1" } - Force
@@ -159,11 +163,11 @@ function Test-WorkspaceEnableDisableListIntelligencePacks
159
163
New-AzureRmResourceGroup - Name $rgname - Location $wslocation - Force
160
164
161
165
# Create and get a workspace
162
- $workspace = New-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name $wsname - Location $wslocation - Sku free - Tags @ {" tag1" = " val1" } - Force
166
+ $workspace = New-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name $wsname - Location $wslocation - Sku " STANDARD " - Tags @ {" tag1" = " val1" } - Force
163
167
Assert-AreEqual $rgname $workspace.ResourceGroupName
164
168
Assert-AreEqual $wsname $workspace.Name
165
169
Assert-AreEqual $wslocation $workspace.Location
166
- Assert-AreEqual " free " $workspace.Sku
170
+ Assert-AreEqual " STANDARD " $workspace.Sku
167
171
Assert-NotNull $workspace.ResourceId
168
172
Assert-AreEqual 1 $workspace.Tags.Count
169
173
Assert-NotNull $workspace.CustomerId
@@ -209,5 +213,5 @@ function Test-WorkspaceEnableDisableListIntelligencePacks
209
213
$workspace | Remove-AzureRmOperationalInsightsWorkspace - Force
210
214
$workspaces = Get-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname
211
215
Assert-AreEqual 0 $workspaces.Count
212
- Assert-ThrowsContains { Get-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name wsname } " ResourceNotFound "
216
+ Assert-ThrowsContains { Get-AzureRmOperationalInsightsWorkspace - ResourceGroupName $rgname - Name wsname } " NotFound "
213
217
}
0 commit comments