@@ -78,22 +78,28 @@ function Test-CreateDatabaseInternal ($serverVersion, $location = "Japan East")
78
78
# Create with all parameters
79
79
$databaseName = Get-DatabaseName
80
80
$db = New-AzureRmSqlDatabase - ResourceGroupName $rg.ResourceGroupName - ServerName $server.ServerName - DatabaseName $databaseName `
81
- - CollationName " Japanese_Bushu_Kakusu_100_CS_AS" - MaxSizeBytes 1 GB - Edition Basic - RequestedServiceObjectiveName Basic
81
+ - CollationName " Japanese_Bushu_Kakusu_100_CS_AS" - MaxSizeBytes 1 GB - Edition Basic - RequestedServiceObjectiveName Basic - Tags @ { " tag_key " = " tag_value " }
82
82
Assert-AreEqual $db.DatabaseName $databaseName
83
83
Assert-AreEqual $db.MaxSizeBytes 1 GB
84
84
Assert-AreEqual $db.Edition Basic
85
85
Assert-AreEqual $db.CurrentServiceObjectiveName Basic
86
86
Assert-AreEqual $db.CollationName " Japanese_Bushu_Kakusu_100_CS_AS"
87
+ Assert-NotNull $db.Tags
88
+ Assert-AreEqual True $db.Tags.ContainsKey (" tag_key" )
89
+ Assert-AreEqual " tag_value" $db.Tags [" tag_key" ]
87
90
88
91
# Create with all parameters
89
92
$databaseName = Get-DatabaseName
90
93
$db = $server | New-AzureRmSqlDatabase - DatabaseName $databaseName `
91
- - CollationName " Japanese_Bushu_Kakusu_100_CS_AS" - MaxSizeBytes 1 GB - Edition Basic - RequestedServiceObjectiveName Basic
94
+ - CollationName " Japanese_Bushu_Kakusu_100_CS_AS" - MaxSizeBytes 1 GB - Edition Basic - RequestedServiceObjectiveName Basic - Tags @ { " tag_key " = " tag_value " }
92
95
Assert-AreEqual $db.DatabaseName $databaseName
93
96
Assert-AreEqual $db.MaxSizeBytes 1 GB
94
97
Assert-AreEqual $db.Edition Basic
95
98
Assert-AreEqual $db.CurrentServiceObjectiveName Basic
96
99
Assert-AreEqual $db.CollationName " Japanese_Bushu_Kakusu_100_CS_AS"
100
+ Assert-NotNull $db.Tags
101
+ Assert-AreEqual True $db.Tags.ContainsKey (" tag_key" )
102
+ Assert-AreEqual " tag_value" $db.Tags [" tag_key" ]
97
103
}
98
104
finally
99
105
{
@@ -142,20 +148,26 @@ function Test-UpdateDatabaseInternal ($serverVersion, $location = "Japan East")
142
148
{
143
149
# Alter all properties
144
150
$db1 = Set-AzureRmSqlDatabase - ResourceGroupName $db.ResourceGroupName - ServerName $db.ServerName - DatabaseName $db.DatabaseName `
145
- - MaxSizeBytes 1 GB - Edition Basic - RequestedServiceObjectiveName Basic
151
+ - MaxSizeBytes 1 GB - Edition Basic - RequestedServiceObjectiveName Basic - Tags @ { " tag_key " = " tag_new_value " }
146
152
Assert-AreEqual $db1.DatabaseName $db.DatabaseName
147
153
Assert-AreEqual $db1.MaxSizeBytes 1 GB
148
154
Assert-AreEqual $db1.Edition Basic
149
155
Assert-AreEqual $db1.CurrentServiceObjectiveName Basic
150
156
Assert-AreEqual $db1.CollationName $db.CollationName
157
+ Assert-NotNull $db.Tags
158
+ Assert-AreEqual True $db.Tags.ContainsKey (" tag_key" )
159
+ Assert-AreEqual " tag_new_value" $db.Tags [" tag_key" ]
151
160
152
161
# Alter all properties using piping
153
- $db2 = $db1 | Set-AzureRmSqlDatabase - MaxSizeBytes 100 GB - Edition Standard - RequestedServiceObjectiveName S1
162
+ $db2 = $db1 | Set-AzureRmSqlDatabase - MaxSizeBytes 100 GB - Edition Standard - RequestedServiceObjectiveName S1 - Tags @ { " tag_key " = " tag_new_value " }
154
163
Assert-AreEqual $db2.DatabaseName $db.DatabaseName
155
164
Assert-AreEqual $db2.MaxSizeBytes 100 GB
156
165
Assert-AreEqual $db2.Edition Standard
157
166
Assert-AreEqual $db2.CurrentServiceObjectiveName S1
158
167
Assert-AreEqual $db2.CollationName $db.CollationName
168
+ Assert-NotNull $db.Tags
169
+ Assert-AreEqual True $db.Tags.ContainsKey (" tag_key" )
170
+ Assert-AreEqual " tag_new_value" $db.Tags [" tag_key" ]
159
171
160
172
# Create and alter data warehouse database.
161
173
$databaseName = Get-DatabaseName
@@ -176,20 +188,26 @@ function Test-UpdateDatabaseInternal ($serverVersion, $location = "Japan East")
176
188
{
177
189
# Alter all properties
178
190
$db1 = Set-AzureRmSqlDatabase - ResourceGroupName $db.ResourceGroupName - ServerName $db.ServerName - DatabaseName $db.DatabaseName `
179
- - MaxSizeBytes 1 GB - Edition Basic - RequestedServiceObjectiveName Basic
191
+ - MaxSizeBytes 1 GB - Edition Basic - RequestedServiceObjectiveName Basic - Tags @ { " tag_key " = " tag_new_value " }
180
192
Assert-AreEqual $db1.DatabaseName $db.DatabaseName
181
193
Assert-AreEqual $db1.MaxSizeBytes 250 GB
182
194
Assert-AreEqual $db1.Edition Standard
183
195
Assert-AreEqual $db1.CurrentServiceObjectiveName S0
184
196
Assert-AreEqual $db1.CollationName $db.CollationName
197
+ Assert-NotNull $db.Tags
198
+ Assert-AreEqual True $db.Tags.ContainsKey (" tag_key" )
199
+ Assert-AreEqual " tag_new_value" $db.Tags [" tag_key" ]
185
200
186
201
# Alter all properties using piping
187
- $db2 = $db1 | Set-AzureRmSqlDatabase - MaxSizeBytes 100 GB - Edition Standard - RequestedServiceObjectiveName S1
202
+ $db2 = $db1 | Set-AzureRmSqlDatabase - MaxSizeBytes 100 GB - Edition Standard - RequestedServiceObjectiveName S1 - Tags @ { " tag_key " = " tag_new_value " }
188
203
Assert-AreEqual $db2.DatabaseName $db.DatabaseName
189
204
Assert-AreEqual $db2.MaxSizeBytes 1 GB
190
205
Assert-AreEqual $db2.Edition Basic
191
206
Assert-AreEqual $db2.CurrentServiceObjectiveName Basic
192
207
Assert-AreEqual $db2.CollationName $db.CollationName
208
+ Assert-NotNull $db.Tags
209
+ Assert-AreEqual True $db.Tags.ContainsKey (" tag_key" )
210
+ Assert-AreEqual " tag_new_value" $db.Tags [" tag_key" ]
193
211
}
194
212
}
195
213
finally
0 commit comments