You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# The user principal name of the account who's user data should be cleared.
28
-
[Parameter(Mandatory=$true)]
29
-
[ValidateNotNullOrEmpty()]
30
-
[string] $UserPrincipalName,
23
+
# Optional: A credential used to authenticate with Azure Stack. Must support a non-interactive authentication flow. If not provided, the script will prompt for user credentials.
24
+
[pscredential] $AutomationCredential=$null,
31
25
32
-
# Optional: The directory tenant identifier of account who's user data should be cleared.
33
-
# If it is not specified, it will delete all the
34
-
[Parameter(Mandatory=$false)]
35
26
[ValidateNotNullOrEmpty()]
36
-
[string] $DirectoryTenantId,
37
-
38
-
# Optional: A credential used to authenticate with Azure Stack. Must support a non-interactive authentication flow. If not provided, the script will prompt for user credentials.
# The directory tenant identifier of Azure Stack Administrator.
102
+
[Parameter(Mandatory=$true)]
103
+
[ValidateNotNullOrEmpty()]
104
+
[string] $AzsAdminDirectoryTenantId,
105
+
106
+
# The Azure Stack ARM endpoint URI.
107
+
[Parameter(Mandatory=$true)]
108
+
[ValidateNotNullOrEmpty()]
109
+
[Uri] $AzsAdminArmEndpoint,
110
+
111
+
# The user principal name of the account whoes user data should be cleared.
112
+
[Parameter(Mandatory=$true)]
113
+
[ValidateNotNullOrEmpty()]
114
+
[string] $UserPrincipalName,
115
+
116
+
# Optional: The directory tenant identifier of account whoes user data should be cleared.
117
+
# If it is not specified, it will delete user with principal name under all regitered directory tenants
118
+
[Parameter(Mandatory=$false)]
119
+
[ValidateNotNullOrEmpty()]
120
+
[string] $DirectoryTenantId,
121
+
122
+
# Optional: A credential used to authenticate with Azure Stack. Must support a non-interactive authentication flow. If not provided, the script will prompt for user credentials.
# The directory tenant identifier of Azure Stack Administrator.
153
+
[Parameter(Mandatory=$true)]
154
+
[ValidateNotNullOrEmpty()]
155
+
[string] $AzsAdminDirectoryTenantId,
156
+
157
+
# The Azure Stack ARM endpoint URI.
158
+
[Parameter(Mandatory=$true)]
159
+
[ValidateNotNullOrEmpty()]
160
+
[Uri] $AzsAdminArmEndpoint,
161
+
162
+
# The user principal name of the account whoes user data should be cleared.
163
+
[Parameter(Mandatory=$true)]
164
+
[ValidateNotNullOrEmpty()]
165
+
[string] $UserPrincipalName,
166
+
167
+
# Optional: The directory tenant identifier of account whoes user data should be cleared.
168
+
# If it is not specified, it will delete user with principal name under all regitered directory tenants
169
+
[Parameter(Mandatory=$false)]
170
+
[ValidateNotNullOrEmpty()]
171
+
[string] $DirectoryTenantId,
172
+
173
+
# Optional: A credential used to authenticate with Azure Stack. Must support a non-interactive authentication flow. If not provided, the script will prompt for user credentials.
Write-Verbose"Retrieved user object as $(ConvertTo-JSON$usersResponse.value)"-Verbose
127
212
128
213
$userObjectId=$usersResponse.value.objectId
@@ -150,10 +235,10 @@ function Clear-AzsUserData
150
235
else
151
236
{
152
237
$params=@{
153
-
AccessToken=$accessToken
238
+
AccessToken=$script:adminArmAccessToken
154
239
UserObjectId=$userObjectId
155
240
DirectoryTenantId=$dirId
156
-
AdminSubscriptionId=$adminSubscriptionId
241
+
AdminSubscriptionId=$script:adminSubscriptionId
157
242
AzsAdminArmEndpoint=$AzsAdminArmEndpoint
158
243
}
159
244
$curResult=Clear-SinglePortalUserData@params
@@ -164,6 +249,102 @@ function Clear-AzsUserData
164
249
return$clearUserDataResult
165
250
}
166
251
252
+
<#
253
+
.Synopsis
254
+
Clear the portal user data
255
+
#>
256
+
functionClear-AzsUserDataWithUserObjectId
257
+
{
258
+
param
259
+
(
260
+
# The directory tenant identifier of Azure Stack Administrator.
261
+
[Parameter(Mandatory=$true)]
262
+
[ValidateNotNullOrEmpty()]
263
+
[string] $AzsAdminDirectoryTenantId,
264
+
265
+
# The Azure Stack ARM endpoint URI.
266
+
[Parameter(Mandatory=$true)]
267
+
[ValidateNotNullOrEmpty()]
268
+
[Uri] $AzsAdminArmEndpoint,
269
+
270
+
# The user object Id of the account whoes user data should be cleared.
271
+
[Parameter(Mandatory=$true)]
272
+
[ValidateNotNullOrEmpty()]
273
+
[string] $UserObjectId,
274
+
275
+
# The directory tenant identifier of account whoes user data should be cleared.
276
+
[Parameter(Mandatory=$true)]
277
+
[ValidateNotNullOrEmpty()]
278
+
[string] $DirectoryTenantId,
279
+
280
+
# Optional: A credential used to authenticate with Azure Stack. Must support a non-interactive authentication flow. If not provided, the script will prompt for user credentials.
# The user principal name of the account whoes user data should be cleared.
320
+
[Parameter(Mandatory=$true)]
321
+
[ValidateNotNullOrEmpty()]
322
+
[string] $UserPrincipalName,
323
+
324
+
# Optional: A credential used to authenticate with Azure Stack. Must support a non-interactive authentication flow. If not provided, the script will prompt for user credentials.
0 commit comments