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
Write-Host ("Connected to Tenant {0} ({1}) as account '{2}'. Domain is '{3}'"-f$Tenant.DisplayName,$Tenant.Id,$currentUserPrincipalName,$verifiedDomainName)
108
+
91
109
# Add user object Id here
92
-
$usersobjectId=Read-Host-Prompt "Enter the object Id (from Azure portal) of the user who will assigned to these security groups"
110
+
$usersobjectId=Read-Host-Prompt "Enter the object Id (from Azure portal) of the user who will assigned to these security groups, or press enter to use the currently signed-in user's object Id - '$($user.Id)'"
Write-Host ("Connected to Tenant {0} ({1}) as account '{2}'. Domain is '{3}'"-f$Tenant.DisplayName,$Tenant.Id,$currentUserPrincipalName,$verifiedDomainName)
81
99
82
100
# now remove groups
83
101
RemoveGroups
84
102
85
103
}
86
104
105
+
87
106
$ErrorActionPreference="Stop"
88
107
89
108
if ($null-eq (Get-Module-ListAvailable -Name "Microsoft.Graph.Authentication"))
Write-Host ("Connected to Tenant {0} ({1}) as account '{2}'. Domain is '{3}'"-f$Tenant.DisplayName,$Tenant.Id,$currentUserPrincipalName,$verifiedDomainName)
143
+
114
144
# Removes the applications
115
145
Write-Host"Cleaning-up applications from tenant '$tenantId'"
116
146
@@ -158,6 +188,24 @@ Function Cleanup
158
188
}
159
189
160
190
# Pre-requisites
191
+
if ($null-eq (Get-Module-ListAvailable -Name "Microsoft.Graph")) {
192
+
Install-Module"Microsoft.Graph"-Scope CurrentUser
193
+
}
194
+
195
+
#Import-Module Microsoft.Graph
196
+
197
+
if ($null-eq (Get-Module-ListAvailable -Name "Microsoft.Graph.Authentication")) {
0 commit comments