Skip to content

Commit fa1280b

Browse files
author
Kalyan Krishna
committed
Minor enhancements to the PS scripts
1 parent 8dd3d5c commit fa1280b

File tree

5 files changed

+31
-17
lines changed

5 files changed

+31
-17
lines changed

1-WebApp-OIDC/1-3-AnyOrgOrPersonal/AppCreationScripts/Cleanup.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ This function removes the Azure AD applications for the sample. These applicatio
5555
if ($app)
5656
{
5757
Remove-AzureADApplication -ObjectId $app.ObjectId
58-
Write-Host "Removed."
58+
Write-Host "Removed WebApp."
59+
}
5960
}
60-
61-
}
6261

6362
Cleanup -Credential $Credential -tenantId $TenantId

1-WebApp-OIDC/1-3-AnyOrgOrPersonal/AppCreationScripts/Configure.ps1

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ Function ConfigureApplications
6464
so that they are consistent with the Applications parameters
6565
#>
6666

67+
$commonendpoint = "common"
68+
6769
# $tenantId is the Active Directory Tenant. This is a GUID which represents the "Directory ID" of the AzureAD tenant
6870
# into which you want to create the apps. Look it up in the Azure portal in the "Properties" of the Azure AD.
6971

@@ -114,8 +116,8 @@ Function ConfigureApplications
114116
$owner = Get-AzureADApplicationOwner -ObjectId $webAppAadApplication.ObjectId
115117
if ($owner -eq $null)
116118
{
117-
Add-AzureADApplicationOwner -ObjectId $webAppAadApplication.ObjectId -RefObjectId $user.ObjectId
118-
Write-Host "'$($user.UserPrincipalName)' added as an application owner to app '$($webAppServicePrincipal.DisplayName)'"
119+
Add-AzureADApplicationOwner -ObjectId $webAppAadApplication.ObjectId -RefObjectId $user.ObjectId
120+
Write-Host "'$($user.UserPrincipalName)' added as an application owner to app '$($webAppServicePrincipal.DisplayName)'"
119121
}
120122

121123
Write-Host "Done creating the webApp application (WebApp)"
@@ -127,12 +129,19 @@ Function ConfigureApplications
127129

128130

129131
# Update config file for 'webApp'
130-
$commonendpoint = "common"
131132
$configFile = $pwd.Path + "\..\appsettings.json"
132133
Write-Host "Updating the sample code ($configFile)"
133-
$dictionary = @{ "ClientId" = $webAppAadApplication.AppId;"TenantId" = $commonendpoint;"Domain" = $tenantName };
134+
$dictionary = @{ "ClientId" = $webAppAadApplication.AppId;"Domain" = $tenantName;"TenantId" = $commonendpoint };
134135
UpdateTextFile -configFilePath $configFile -dictionary $dictionary
135-
136+
Write-Host ""
137+
Write-Host -ForegroundColor Green "------------------------------------------------------------------------------------------------"
138+
Write-Host "IMPORTANT: Please follow the instructions below to complete a few manual step(s) in the Azure portal":
139+
Write-Host "- For 'webApp'"
140+
Write-Host " - Navigate to '$webAppPortalUrl'"
141+
Write-Host " - Navigate to the portal and change the ','signInAudeince' to 'AzureADandPersonalMicrosoftAccount' in the app's manifest !" -ForegroundColor Red
142+
143+
Write-Host -ForegroundColor Green "------------------------------------------------------------------------------------------------"
144+
136145
Add-Content -Value "</tbody></table></body></html>" -Path createdApps.html
137146
}
138147

1-WebApp-OIDC/1-3-AnyOrgOrPersonal/AppCreationScripts/sample.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@
1919
"Audience" : "AzureADandPersonalMicrosoftAccount",
2020
"HomePage": "https://localhost:44321/",
2121
"ReplyUrls": "https://localhost:44321/, https://localhost:44321/signin-oidc",
22-
"LogoutUrl": "https://localhost:44321/signout-oidc"
23-
}
24-
],
22+
"LogoutUrl": "https://localhost:44321/signout-oidc",
23+
"ManualSteps": [
24+
{
25+
"Comment" : "Navigate to the portal and change the ','signInAudeince' to 'AzureADandPersonalMicrosoftAccount' in the app's manifest !"
26+
}
27+
]
2528

29+
}
30+
],
2631
/*
2732
This section describes how to update the code in configuration files from the apps coordinates, once the apps
2833
are created in Azure AD.
@@ -39,13 +44,13 @@
3944
"key": "ClientId",
4045
"value": ".AppId"
4146
},
42-
{
43-
"key": "TenantId",
44-
"value": "$commonendpoint"
45-
},
4647
{
4748
"key": "Domain",
4849
"value": "$tenantName"
50+
},
51+
{
52+
"key": "TenantId",
53+
"value": "$commonendpoint"
4954
}
5055
]
5156
}

1-WebApp-OIDC/1-3-AnyOrgOrPersonal/README-1-1-to-1-3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ endpoint: AAD v2.0
1616

1717
![Sign in with Azure AD](ReadmeFiles/sign-in.png)
1818

19-
> This is the third chapter of the first phase of this ASP.NET Core Web App tutorial. You learnt previously how to build an ASP.NET Core Web app signing-in users with the Microsoft identity platform in [your organization](../1-1-MyOrg) or [any organization](../1-2-AnyOrg). This chapter describes how to change that application to enable users to sign-in from any work or school account or Microsoft personal account.
19+
> This is the third chapter of the first phase of this ASP.NET Core Web App tutorials. You learnt previously how to build an ASP.NET Core Web app that signs-in users with the Microsoft identity platform in [your organization](../1-1-MyOrg) or [any organization](../1-2-AnyOrg). This chapter describes how to change that application to enable users to sign-in from any work or school account or Microsoft personal account.
2020
>
2121
> If you are not interested in the differentials, but want to understand all the steps, read the full [Readme.md](./Readme.md)
2222

1-WebApp-OIDC/1-3-AnyOrgOrPersonal/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ This sample shows how to build an ASP.NET Core 2.2 MVC Web app that uses OpenID
1919
![Sign in with Azure AD](ReadmeFiles/sign-in.png)
2020

2121
> This is the first chapter of this ASP.NET Core Web App tutorial. Once you understand how to sign-in users in an ASP.NET Core Web App with Open Id Connect, can learn how to enable your [Web App to call a Web API on behalf of the signed-in user](../../2-WebApp-graph-user) in a later chapter.
22-
You can also sign-in users in your own Azure Active Directory organizations, any organization and even with social identities. For more details the parent directory's [Readme.md](../Readme.md)
22+
You can also sign-in users in your own Azure Active Directory organizations, any organization and even with social identities. For more details the parent directory's [Readme.md](../Readme.md)
23+
2324
## How to run this sample
2425

2526
To run this sample:

0 commit comments

Comments
 (0)