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
[Parameter(Mandatory=$False,HelpMessage='Tenant ID (This is a GUID which represents the "Directory ID" of the AzureAD tenant into which you want to create the apps')]
5
-
[string] $tenantId
6
+
[string] $tenantId,
7
+
[Parameter(Mandatory=$False,HelpMessage='Azure environment to use while running the script. Default = Global')]
8
+
[string] $azureEnvironmentName
6
9
)
7
10
8
-
if ($null-eq (Get-Module-ListAvailable -Name "AzureAD")) {
9
-
Install-Module"AzureAD"-Scope CurrentUser
10
-
}
11
-
Import-Module AzureAD
12
-
$ErrorActionPreference="Stop"
13
11
14
12
FunctionCleanup
15
13
{
16
-
<#
17
-
.Description
18
-
This function removes the Azure AD applications for the sample. These applications were created by the Configure.ps1 script
19
-
#>
14
+
if (!$azureEnvironmentName)
15
+
{
16
+
$azureEnvironmentName="Global"
17
+
}
18
+
19
+
<#
20
+
.Description
21
+
This function removes the Azure AD applications for the sample. These applications were created by the Configure.ps1 script
22
+
#>
20
23
21
24
# $tenantId is the Active Directory Tenant. This is a GUID which represents the "Directory ID" of the AzureAD tenant
22
25
# into which you want to create the apps. Look it up in the Azure portal in the "Properties" of the Azure AD.
23
26
24
-
# Login to Azure PowerShell (interactive if credentials are not already provided:
25
-
# you'll need to sign-in with creds enabling your to create apps in the tenant)
Write-Host ("Connected to Tenant {0} ({1}) as account '{2}'. Domain is '{3}'"-f$Tenant.DisplayName,$Tenant.Id,$currentUserPrincipalName,$verifiedDomainName)
56
+
49
57
# Removes the applications
50
-
Write-Host"Cleaning-up applications from tenant '$tenantName'"
58
+
Write-Host"Cleaning-up applications from tenant '$tenantId'"
Write-Host"Unable to remove ServicePrincipal 'WebApp'. Error is $message. Try deleting manually from Enterprise applications."-ForegroundColor White -BackgroundColor Red
96
+
}
97
+
}
98
+
99
+
# Pre-requisites
100
+
if ($null-eq (Get-Module-ListAvailable -Name "Microsoft.Graph")) {
101
+
Install-Module"Microsoft.Graph"-Scope CurrentUser
102
+
}
103
+
104
+
#Import-Module Microsoft.Graph
105
+
106
+
if ($null-eq (Get-Module-ListAvailable -Name "Microsoft.Graph.Authentication")) {
0 commit comments