|
5 | 5 | [string] $tenantId |
6 | 6 | ) |
7 | 7 |
|
8 | | -if ((Get-Module -ListAvailable -Name "AzureAD") -eq $null) { |
| 8 | +if ($null -eq (Get-Module -ListAvailable -Name "AzureAD")) { |
9 | 9 | Install-Module "AzureAD" -Scope CurrentUser |
10 | 10 | } |
11 | 11 | Import-Module AzureAD |
@@ -44,27 +44,28 @@ This function removes the Azure AD applications for the sample. These applicatio |
44 | 44 | $tenantId = $creds.Tenant.Id |
45 | 45 | } |
46 | 46 | $tenant = Get-AzureADTenantDetail |
47 | | - $tenantName = ($tenant.VerifiedDomains | Where { $_._Default -eq $True }).Name |
| 47 | + $tenantName = ($tenant.VerifiedDomains | Where-Object { $_._Default -eq $True }).Name |
48 | 48 |
|
49 | 49 | # Removes the applications |
50 | 50 | Write-Host "Cleaning-up applications from tenant '$tenantName'" |
51 | 51 |
|
52 | 52 | Write-Host "Removing 'service' (TodoListService (active-directory-dotnet-native-aspnetcore-v2)) if needed" |
53 | | - $app=Get-AzureADApplication -Filter "DisplayName eq 'TodoListService (active-directory-dotnet-native-aspnetcore-v2)'" |
| 53 | + $apps=Get-AzureADApplication -Filter "DisplayName eq 'TodoListService (active-directory-dotnet-native-aspnetcore-v2)'" |
54 | 54 |
|
55 | | - if ($app) |
| 55 | + foreach ($app in $apps) |
56 | 56 | { |
57 | 57 | Remove-AzureADApplication -ObjectId $app.ObjectId |
58 | 58 | Write-Host "Removed TodoListService (active-directory-dotnet-native-aspnetcore-v2)." |
59 | 59 | } |
| 60 | + |
60 | 61 | Write-Host "Removing 'client' (TodoListClient (active-directory-dotnet-native-aspnetcore-v2)) if needed" |
61 | | - $app=Get-AzureADApplication -Filter "DisplayName eq 'TodoListClient (active-directory-dotnet-native-aspnetcore-v2)'" |
| 62 | + $apps=Get-AzureADApplication -Filter "DisplayName eq 'TodoListClient (active-directory-dotnet-native-aspnetcore-v2)'" |
62 | 63 |
|
63 | | - if ($app) |
| 64 | + foreach ($app in $apps) |
64 | 65 | { |
65 | 66 | Remove-AzureADApplication -ObjectId $app.ObjectId |
66 | 67 | Write-Host "Removed TodoListClient (active-directory-dotnet-native-aspnetcore-v2)." |
67 | 68 | } |
68 | | - } |
| 69 | +} |
69 | 70 |
|
70 | 71 | Cleanup -Credential $Credential -tenantId $TenantId |
0 commit comments