Skip to content

Commit fce718f

Browse files
author
Kalyan Krishna
committed
Issues added, with code and doc updated
1 parent 9075600 commit fce718f

File tree

9 files changed

+106
-297
lines changed

9 files changed

+106
-297
lines changed

AppCreationScripts/Cleanup.ps1

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ param(
55
[string] $tenantId
66
)
77

8-
if ((Get-Module -ListAvailable -Name "AzureAD") -eq $null) {
8+
if ($null -eq (Get-Module -ListAvailable -Name "AzureAD")) {
99
Install-Module "AzureAD" -Scope CurrentUser
1010
}
1111
Import-Module AzureAD
@@ -44,7 +44,7 @@ This function removes the Azure AD applications for the sample. These applicatio
4444
$tenantId = $creds.Tenant.Id
4545
}
4646
$tenant = Get-AzureADTenantDetail
47-
$tenantName = ($tenant.VerifiedDomains | Where { $_._Default -eq $True }).Name
47+
$tenantName = ($tenant.VerifiedDomains | Where-Object { $_._Default -eq $True }).Name
4848

4949
# Removes the applications
5050
Write-Host "Cleaning-up applications from tenant '$tenantName'"
@@ -56,19 +56,31 @@ This function removes the Azure AD applications for the sample. These applicatio
5656
{
5757
Remove-AzureADApplication -ObjectId $apps.ObjectId
5858
}
59-
# Get-AzureRmADServicePrincipal -SearchString "TodoListService-ManualJwt" | ForEach-Object {Remove-AzureRmADServicePrincipal -ObjectId $_.Id -Confirm:$false}
60-
Write-Host "Removed TodoListService-ManualJwt."
6159

60+
foreach ($app in $apps)
61+
{
62+
Remove-AzureADApplication -ObjectId $app.ObjectId
63+
Write-Host "Removed TodoListService-ManualJwt.."
64+
}
65+
# also remove service principals of this app
66+
Get-AzureADServicePrincipal -filter "DisplayName eq 'TodoListService-ManualJwt'" | ForEach-Object {Remove-AzureADServicePrincipal -ObjectId $_.Id -Confirm:$false}
67+
6268
Write-Host "Removing 'client' (TodoListClient-ManualJwt) if needed"
6369
Get-AzureADApplication -Filter "DisplayName eq 'TodoListClient-ManualJwt'" | ForEach-Object {Remove-AzureADApplication -ObjectId $_.ObjectId }
6470
$apps = Get-AzureADApplication -Filter "DisplayName eq 'TodoListClient-ManualJwt'"
6571
if ($apps)
6672
{
6773
Remove-AzureADApplication -ObjectId $apps.ObjectId
6874
}
69-
# Get-AzureRmADServicePrincipal -SearchString "TodoListClient-ManualJwt" | ForEach-Object {Remove-AzureRmADServicePrincipal -ObjectId $_.Id -Confirm:$false}
70-
Write-Host "Removed TodoListClient-ManualJwt."
7175

76+
foreach ($app in $apps)
77+
{
78+
Remove-AzureADApplication -ObjectId $app.ObjectId
79+
Write-Host "Removed TodoListClient-ManualJwt.."
80+
}
81+
# also remove service principals of this app
82+
Get-AzureADServicePrincipal -filter "DisplayName eq 'TodoListClient-ManualJwt'" | ForEach-Object {Remove-AzureADServicePrincipal -ObjectId $_.Id -Confirm:$false}
83+
7284
}
7385

74-
Cleanup -Credential $Credential -tenantId $TenantId
86+
Cleanup -Credential $Credential -tenantId $TenantId

AppCreationScripts/Configure.ps1

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ Function ConfigureApplications
101101
so that they are consistent with the Applications parameters
102102
#>
103103

104+
$commonendpoint = "common"
105+
104106
# $tenantId is the Active Directory Tenant. This is a GUID which represents the "Directory ID" of the AzureAD tenant
105107
# into which you want to create the apps. Look it up in the Azure portal in the "Properties" of the Azure AD.
106108

@@ -148,8 +150,8 @@ Function ConfigureApplications
148150
$owner = Get-AzureADApplicationOwner -ObjectId $serviceAadApplication.ObjectId
149151
if ($owner -eq $null)
150152
{
151-
Add-AzureADApplicationOwner -ObjectId $serviceAadApplication.ObjectId -RefObjectId $user.ObjectId
152-
Write-Host "'$($user.UserPrincipalName)' added as an application owner to app '$($serviceServicePrincipal.DisplayName)'"
153+
Add-AzureADApplicationOwner -ObjectId $serviceAadApplication.ObjectId -RefObjectId $user.ObjectId
154+
Write-Host "'$($user.UserPrincipalName)' added as an application owner to app '$($serviceServicePrincipal.DisplayName)'"
153155
}
154156

155157
Write-Host "Done creating the service application (TodoListService-ManualJwt)"
@@ -172,8 +174,8 @@ Function ConfigureApplications
172174
$owner = Get-AzureADApplicationOwner -ObjectId $clientAadApplication.ObjectId
173175
if ($owner -eq $null)
174176
{
175-
Add-AzureADApplicationOwner -ObjectId $clientAadApplication.ObjectId -RefObjectId $user.ObjectId
176-
Write-Host "'$($user.UserPrincipalName)' added as an application owner to app '$($clientServicePrincipal.DisplayName)'"
177+
Add-AzureADApplicationOwner -ObjectId $clientAadApplication.ObjectId -RefObjectId $user.ObjectId
178+
Write-Host "'$($user.UserPrincipalName)' added as an application owner to app '$($clientServicePrincipal.DisplayName)'"
177179
}
178180

179181
Write-Host "Done creating the client application (TodoListClient-ManualJwt)"
@@ -210,7 +212,7 @@ Function ConfigureApplications
210212
ReplaceSetting -configFilePath $configFile -key "ida:ClientId" -newValue $clientAadApplication.AppId
211213
ReplaceSetting -configFilePath $configFile -key "todo:TodoListResourceId" -newValue $serviceIdentifierUri
212214
ReplaceSetting -configFilePath $configFile -key "todo:TodoListBaseAddress" -newValue $serviceAadApplication.HomePage
213-
215+
214216
Add-Content -Value "</tbody></table></body></html>" -Path createdApps.html
215217
}
216218

0 commit comments

Comments
 (0)