Skip to content

Commit 764e654

Browse files
author
Tiago Brenck
committed
AppCreationScripts update
README update
1 parent c471ba2 commit 764e654

File tree

5 files changed

+22
-36
lines changed

5 files changed

+22
-36
lines changed

2-WebApp-graph-user/2-3-Multi-Tenant/AppCreationScripts/AppCreationScripts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Registering the sample apps with Microsoft Identity Platform and updating the configuration files using PowerShell scripts
1+
# Registering the sample apps with Microsoft identity platform and updating the configuration files using PowerShell scripts
22

33
## Overview
44

2-WebApp-graph-user/2-3-Multi-Tenant/AppCreationScripts/Cleanup.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ This function removes the Azure AD applications for the sample. These applicatio
4949
# Removes the applications
5050
Write-Host "Cleaning-up applications from tenant '$tenantName'"
5151

52-
Write-Host "Removing 'webApp' (WebApp) if needed"
53-
Get-AzureADApplication -Filter "DisplayName eq 'WebApp'" | ForEach-Object {Remove-AzureADApplication -ObjectId $_.ObjectId }
54-
$apps = Get-AzureADApplication -Filter "DisplayName eq 'WebApp'"
52+
Write-Host "Removing 'webApp' (WebApp-MultiTenant-v2) if needed"
53+
Get-AzureADApplication -Filter "DisplayName eq 'WebApp-MultiTenant-v2'" | ForEach-Object {Remove-AzureADApplication -ObjectId $_.ObjectId }
54+
$apps = Get-AzureADApplication -Filter "DisplayName eq 'WebApp-MultiTenant-v2'"
5555
if ($apps)
5656
{
5757
Remove-AzureADApplication -ObjectId $apps.ObjectId
@@ -60,10 +60,10 @@ This function removes the Azure AD applications for the sample. These applicatio
6060
foreach ($app in $apps)
6161
{
6262
Remove-AzureADApplication -ObjectId $app.ObjectId
63-
Write-Host "Removed WebApp.."
63+
Write-Host "Removed WebApp-MultiTenant-v2.."
6464
}
6565
# also remove service principals of this app
66-
Get-AzureADServicePrincipal -filter "DisplayName eq 'WebApp'" | ForEach-Object {Remove-AzureADServicePrincipal -ObjectId $_.Id -Confirm:$false}
66+
Get-AzureADServicePrincipal -filter "DisplayName eq 'WebApp-MultiTenant-v2'" | ForEach-Object {Remove-AzureADServicePrincipal -ObjectId $_.Id -Confirm:$false}
6767

6868
}
6969

2-WebApp-graph-user/2-3-Multi-Tenant/AppCreationScripts/Configure.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,18 +181,18 @@ Function ConfigureApplications
181181
$user = Get-AzureADUser -ObjectId $creds.Account.Id
182182

183183
# Create the webApp AAD application
184-
Write-Host "Creating the AAD application (WebApp)"
184+
Write-Host "Creating the AAD application (WebApp-MultiTenant-v2)"
185185
# Get a 2 years application key for the webApp Application
186186
$pw = ComputePassword
187187
$fromDate = [DateTime]::Now;
188188
$key = CreateAppKey -fromDate $fromDate -durationInYears 2 -pw $pw
189189
$webAppAppKey = $pw
190190
# create the application
191-
$webAppAadApplication = New-AzureADApplication -DisplayName "WebApp" `
191+
$webAppAadApplication = New-AzureADApplication -DisplayName "WebApp-MultiTenant-v2" `
192192
-HomePage "https://localhost:44321/" `
193193
-LogoutUrl "https://localhost:44321/signout-oidc" `
194194
-ReplyUrls "https://localhost:44321/", "https://localhost:44321/signin-oidc" `
195-
-IdentifierUris "https://$tenantName/WebApp" `
195+
-IdentifierUris "https://$tenantName/WebApp-MultiTenant-v2" `
196196
-AvailableToOtherTenants $True `
197197
-PasswordCredentials $key `
198198
-Oauth2AllowImplicitFlow $true `
@@ -211,12 +211,12 @@ Function ConfigureApplications
211211
}
212212

213213

214-
Write-Host "Done creating the webApp application (WebApp)"
214+
Write-Host "Done creating the webApp application (WebApp-MultiTenant-v2)"
215215

216216
# URL of the AAD application in the Azure portal
217217
# Future? $webAppPortalUrl = "https://portal.azure.com/#@"+$tenantName+"/blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/Overview/appId/"+$webAppAadApplication.AppId+"/objectId/"+$webAppAadApplication.ObjectId+"/isMSAApp/"
218218
$webAppPortalUrl = "https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/CallAnAPI/appId/"+$webAppAadApplication.AppId+"/objectId/"+$webAppAadApplication.ObjectId+"/isMSAApp/"
219-
Add-Content -Value "<tr><td>webApp</td><td>$currentAppId</td><td><a href='$webAppPortalUrl'>WebApp</a></td></tr>" -Path createdApps.html
219+
Add-Content -Value "<tr><td>webApp</td><td>$currentAppId</td><td><a href='$webAppPortalUrl'>WebApp-MultiTenant-v2</a></td></tr>" -Path createdApps.html
220220

221221
$requiredResourcesAccess = New-Object System.Collections.Generic.List[Microsoft.Open.AzureAD.Model.RequiredResourceAccess]
222222

@@ -234,7 +234,7 @@ Function ConfigureApplications
234234
# Update config file for 'webApp'
235235
$configFile = $pwd.Path + "\..\appsettings.json"
236236
Write-Host "Updating the sample code ($configFile)"
237-
$dictionary = @{ "ClientId" = $webAppAadApplication.AppId;"TenantId" = "organizations";"Domain" = $tenantName;"ClientSecret" = $webAppAppKey };
237+
$dictionary = @{ "ClientId" = $webAppAadApplication.AppId;"TenantId" = 'organizations';"Domain" = $tenantName;"ClientSecret" = $webAppAppKey };
238238
UpdateTextFile -configFilePath $configFile -dictionary $dictionary
239239

240240
Add-Content -Value "</tbody></table></body></html>" -Path createdApps.html

2-WebApp-graph-user/2-3-Multi-Tenant/AppCreationScripts/sample.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"Sample": {
33
"Title": "An ASP.NET Core 2.x Web App which lets sign-in users with work and school in any org",
4-
"Level": 200,
4+
"Level": 400,
55
"Client": "ASP.NET Core 2.x Web App",
66
"Service": "Microsoft Graph",
77
"RepositoryUrl": "microsoft-identity-platform-aspnetcore-webapp-tutorial",
@@ -14,7 +14,7 @@
1414
"AADApps": [
1515
{
1616
"Id": "webApp",
17-
"Name": "WebApp",
17+
"Name": "WebApp-MultiTenant-v2",
1818
"Kind": "WebApp",
1919
"Audience": "AzureADMultipleOrgs",
2020
"HomePage": "https://localhost:44321/",
@@ -48,7 +48,7 @@
4848
},
4949
{
5050
"key": "TenantId",
51-
"value": "organizations"
51+
"value": "'organizations'"
5252
},
5353
{
5454
"key": "Domain",

2-WebApp-graph-user/2-3-Multi-Tenant/README.md

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ endpoint: Microsoft identity platform
1010

1111
# An ASP.NET Core Web app signing-in users in any org with the Microsoft identity platform
1212

13-
> This sample is for Azure AD, not Azure AD B2C. See [active-directory-b2c-dotnetcore-webapp](https://github.com/Azure-Samples/active-directory-b2c-dotnetcore-webapp), until we incorporate the B2C variation in the tutorial.
13+
> This sample is for Azure AD, not Azure AD B2C.
1414
1515
[![Build status](https://identitydivision.visualstudio.com/IDDP/_apis/build/status/AAD%20Samples/.NET%20client%20samples/ASP.NET%20Core%20Web%20App%20tutorial)](https://identitydivision.visualstudio.com/IDDP/_build/latest?definitionId=819)
1616

@@ -20,9 +20,6 @@ This sample shows how to build a .NET Core MVC Web app that uses OpenID Connect
2020

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

23-
> This is the second chapter of the first phase 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, you 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.
24-
> You can also sign-in users in your own Azure Active Directory organizations, and even with Microsoft personal accounts or social identities. For more details the parent directory's [Readme.md](../README.md)
25-
2623
## How to run this sample
2724

2825
To run this sample:
@@ -37,7 +34,7 @@ From your shell or command line:
3734

3835
```Shell
3936
git clone https://github.com/Azure-Samples/microsoft-identity-platform-aspnetcore-webapp-tutorial.git
40-
cd "1-WebApp-OIDC\1-2-AnyOrg"
37+
cd "2-WebApp-graph-user\2-3-Multi-Tenant"
4138
```
4239

4340
or download and extract the repository .zip file.
@@ -89,12 +86,12 @@ As a first step you'll need to:
8986
1. If your account is present in more than one Azure AD tenant, select your profile at the top right corner in the menu on top of the page, and then **switch directory**.
9087
Change your portal session to the desired Azure AD tenant.
9188

92-
#### Register the client app (WebApp)
89+
#### Register the web app (WebApp-MultiTenant-v2)
9390

9491
1. Navigate to the Microsoft identity platform for developers [App registrations](https://go.microsoft.com/fwlink/?linkid=2083908) page.
9592
1. Click **New registration** on top.
9693
1. In the **Register an application page** that appears, enter your application's registration information:
97-
- In the **Name** section, enter a meaningful application name that will be displayed to users of the app, for example `WebApp`.
94+
- In the **Name** section, enter a meaningful application name that will be displayed to users of the app, for example `WebApp-MultiTenant-v2`.
9895
- Change **Supported account types** to **Accounts in any organizational directory**.
9996
> Note that there are more than one redirect URIs used in this sample. You'll need to add them from the **Authentication** tab later after the app has been created successfully.
10097
1. Click on the **Register** button in bottom to create the application.
@@ -120,16 +117,16 @@ As a first step you'll need to:
120117
- In the **Delegated permissions** section, select the **Directory.Read.All** in the list. Use the search box if necessary.
121118
- Click on the **Add permissions** button in the bottom.
122119

123-
##### Configure the project (WebApp) to use your app registration
120+
##### Configure the project (WebApp-OpenIDConnect-DotNet) to use your app registration
124121

125122
Open the project in your IDE (like Visual Studio) to configure the code.
126123
>In the steps below, "ClientID" is the same as "Application ID" or "AppId".
127124
128125
1. Open the `appsettings.json` file
129-
1. Find the app key `ClientId` and replace the existing value with the application ID (clientId) of the `WebApp` application copied from the Azure portal.
126+
1. Find the app key `ClientId` and replace the existing value with the application ID (clientId) of the `WebApp-MultiTenant-v2` application copied from the Azure portal.
130127
1. Find the app key `TenantId` and replace the existing value with `organizations`.
131128
1. Find the app key `Domain` and replace the existing value with your Azure AD tenant name.
132-
1. Find the app key `ClientSecret` and replace the existing value with the key you saved during the creation of the `WebApp` app, in the Azure portal.
129+
1. Find the app key `ClientSecret` and replace the existing value with the key you saved during the creation of the `WebApp-MultiTenant-v2` app, in the Azure portal.
133130

134131
### Step 4: Run the sample
135132

@@ -280,14 +277,6 @@ If you'd like to contribute to this sample, see [CONTRIBUTING.MD](/CONTRIBUTING.
280277

281278
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
282279

283-
## Next steps
284-
285-
Learn how to:
286-
287-
- Change your web app to sign-in users with [any Microsoft accounts](../1-3-AnyOrgOrPersonal/README-1-1-to-1-3.md)
288-
- Enable users from [National clouds](../1-4-Sovereign) to sign-in to your application
289-
- enable your [Web App to call a Web API on behalf of the signed-in user](../../2-WebApp-graph-user)
290-
291280
## Learn more
292281
To understand more about token validation, see
293282
- [Validating tokens](https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/wiki/ValidatingTokens)
@@ -296,6 +285,3 @@ To understand more about app registration, see:
296285

297286
- [Quickstart: Register an application with the Microsoft identity platform (Preview)](https://docs.microsoft.com/azure/active-directory/develop/quickstart-register-app)
298287
- [Quickstart: Configure a client application to access web APIs (Preview)](https://docs.microsoft.com/azure/active-directory/develop/quickstart-configure-app-access-web-apis)
299-
300-
## Previous steps
301-
- enable [your organization](../1-1-MyOrg) only to sign-in to your web app.

0 commit comments

Comments
 (0)