@@ -114,7 +114,7 @@ public PSNamespaceAttributes BeginCreateNamespace(string resourceGroupName, stri
114
114
if ( identityType != null )
115
115
{
116
116
parameter . Identity = new Identity ( ) ;
117
- parameter . Identity = FindIdentity ( identityType ) ;
117
+ parameter . Identity . Type = FindIdentity ( identityType ) ;
118
118
}
119
119
120
120
if ( identityIds != null )
@@ -132,6 +132,11 @@ public PSNamespaceAttributes BeginCreateNamespace(string resourceGroupName, stri
132
132
{
133
133
parameter . Identity . UserAssignedIdentities = UserAssignedIdentities ;
134
134
}
135
+
136
+ if ( parameter . Identity . Type == ManagedServiceIdentityType . None || parameter . Identity . Type == ManagedServiceIdentityType . SystemAssigned )
137
+ {
138
+ throw new Exception ( "Please change -IdentityType to 'UserAssigned' or 'SystemAssigned, UserAssigned' if you want to add User Assigned Identities" ) ;
139
+ }
135
140
}
136
141
137
142
if ( encryptionconfigs != null )
@@ -204,9 +209,14 @@ public PSNamespaceAttributes UpdateNamespace(string resourceGroupName, string na
204
209
205
210
if ( identityType != null )
206
211
{
207
- parameter . Identity = new Identity ( ) ;
208
- parameter . Identity = FindIdentity ( identityType ) ;
209
- if ( parameter . Identity . Type == ManagedServiceIdentityType . None )
212
+ if ( parameter . Identity == null )
213
+ {
214
+ parameter . Identity = new Identity ( ) ;
215
+ }
216
+
217
+ parameter . Identity . Type = FindIdentity ( identityType ) ;
218
+
219
+ if ( parameter . Identity . Type == ManagedServiceIdentityType . None || parameter . Identity . Type == ManagedServiceIdentityType . SystemAssigned )
210
220
{
211
221
parameter . Identity . UserAssignedIdentities = null ;
212
222
}
@@ -226,6 +236,10 @@ public PSNamespaceAttributes UpdateNamespace(string resourceGroupName, string na
226
236
{
227
237
parameter . Identity . UserAssignedIdentities = UserAssignedIdentities ;
228
238
}
239
+ if ( parameter . Identity . Type == ManagedServiceIdentityType . None || parameter . Identity . Type == ManagedServiceIdentityType . SystemAssigned )
240
+ {
241
+ throw new Exception ( "Please change -IdentityType to 'UserAssigned' or 'SystemAssigned, UserAssigned' if you want to add User Assigned Identities" ) ;
242
+ }
229
243
}
230
244
231
245
if ( encryptionconfigs != null )
@@ -264,26 +278,26 @@ public PSNamespaceAttributes UpdateNamespace(string resourceGroupName, string na
264
278
return new PSNamespaceAttributes ( response ) ;
265
279
}
266
280
267
- public Identity FindIdentity ( string identityType )
281
+ public ManagedServiceIdentityType FindIdentity ( string identityType )
268
282
{
269
- Identity identity = new Identity ( ) ;
270
-
283
+ ManagedServiceIdentityType Type = ManagedServiceIdentityType . None ;
271
284
if ( identityType == SystemAssigned )
272
- identity . Type = ManagedServiceIdentityType . SystemAssigned ;
285
+ Type = ManagedServiceIdentityType . SystemAssigned ;
273
286
274
287
else if ( identityType == UserAssigned )
275
- identity . Type = ManagedServiceIdentityType . UserAssigned ;
288
+ Type = ManagedServiceIdentityType . UserAssigned ;
276
289
277
290
else if ( identityType == SystemAssignedUserAssigned )
278
- identity . Type = ManagedServiceIdentityType . SystemAssignedUserAssigned ;
291
+ Type = ManagedServiceIdentityType . SystemAssignedUserAssigned ;
279
292
280
293
else if ( identityType == None )
281
- identity . Type = ManagedServiceIdentityType . None ;
294
+ Type = ManagedServiceIdentityType . None ;
282
295
283
- return identity ;
296
+ return Type ;
284
297
}
285
298
286
299
300
+
287
301
public bool BeginDeleteNamespace ( string resourceGroupName , string namespaceName )
288
302
{
289
303
Client . Namespaces . DeleteWithHttpMessagesAsync ( resourceGroupName , namespaceName , null , new CancellationToken ( ) ) . ConfigureAwait ( false ) ;
0 commit comments