Skip to content

Commit 654db35

Browse files
author
Tiago Brenck
committed
MSA and non MSA accounts can be used now
1 parent c4f402e commit 654db35

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

3.-Web-api-call-Microsoft-graph-for-personal-accounts/AppCreationScripts/Configure.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,14 +337,15 @@ Function ConfigureApplications
337337
$configFile = $pwd.Path + "\..\TodoListClient\App.Config"
338338
Write-Host "Updating the sample code ($configFile)"
339339
ReplaceSetting -configFilePath $configFile -key "ida:ClientId" -newValue ($serviceAadApplication.AppId)
340-
ReplaceSetting -configFilePath $configFile -key "todo:TodoListScope" -newValue ($serviceAadApplication.AppId+"/access_as_user")
340+
ReplaceSetting -configFilePath $configFile -key "todo:TodoListScope" -newValue ('https://'+$tenantName+"/TodoListClient-and-Service/access_as_user")
341341
ReplaceSetting -configFilePath $configFile -key "todo:TodoListBaseAddress" -newValue ($serviceAadApplication.HomePage)
342342
Write-Host ""
343343
Write-Host -ForegroundColor Green "------------------------------------------------------------------------------------------------"
344344
Write-Host "IMPORTANT: Please follow the instructions below to complete a few manual step(s) in the Azure portal":
345345
Write-Host "- For 'service'"
346346
Write-Host " - Navigate to '$servicePortalUrl'"
347347
Write-Host " - Navigate to the Authentication blade, click 'Add a platform' then check the option https://login.microsoftonline.com/common/oauth2/nativeclient" -ForegroundColor Red
348+
Write-Host " - Navigate to the Expose an API blade and change the Application ID URI to use the https pattern. i.e. https://<tenant_domain>/<app_name>" -ForegroundColor Red
348349
Write-Host " - Navigate to the Manifest page and change 'signInAudience' to 'AzureADandPersonalMicrosoftAccount'." -ForegroundColor Red
349350
Write-Host " - Navigate to the Manifest page and change 'accessTokenAcceptedVersion' to 2." -ForegroundColor Red
350351
Write-Host " - [Optional] If you are a tenant admin, you can navigate to the API Permisions page and select 'Grant admin consent for (your tenant)'" -ForegroundColor Red

3.-Web-api-call-Microsoft-graph-for-personal-accounts/AppCreationScripts/sample.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
{
3333
"Comment": "Navigate to the Authentication blade, click 'Add a platform' then check the option https://login.microsoftonline.com/common/oauth2/nativeclient"
3434
},
35+
{
36+
"Comment": "Navigate to the Expose an API blade and change the Application ID URI to use the https pattern. i.e. https://<tenant_domain>/<app_name>"
37+
},
3538
{
3639
"Comment": "Navigate to the Manifest page and change 'signInAudience' to 'AzureADandPersonalMicrosoftAccount'."
3740
},
@@ -83,7 +86,7 @@
8386
},
8487
{
8588
"key": "todo:TodoListScope",
86-
"value": "service.AppId+\"/access_as_user\""
89+
"value": "'https://'+$tenantName+\"/TodoListClient-and-Service/access_as_user\""
8790
},
8891
{
8992
"key": "todo:TodoListBaseAddress",

3.-Web-api-call-Microsoft-graph-for-personal-accounts/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ As a first step you'll need to:
127127
it, users will be presented a consent screen enabling them to consent to using the web api.
128128
1. Select the **Expose an API** section, and:
129129
- Select **Add a scope**
130-
- accept the proposed Application ID URI (api://{clientId}) by selecting **Save and Continue**
130+
- Change the Application ID URI to the https pattern, [check AzureADandPersonalMicrosoftAccount restrictions](https://docs.microsoft.com/en-us/azure/active-directory/develop/supported-accounts-validation), (https://{tenant-domain}/{app-name}) and select **Save and Continue**.
131131
- Enter the following parameters
132132
- for **Scope name** use `access_as_user`
133133
- Keep **Admins and users** for **Who can consent**
@@ -179,7 +179,7 @@ Note: if you used the setup scripts, the changes below will have been applied fo
179179

180180
1. In the *TodoListClient* project, open `App.config`.
181181
1. Find the app key `ida:ClientId` and replace the value with the ApplicationID (Client ID) for the *TodoListClient-and-Service* app copied from the app registration page.
182-
1. Find the app key `todo:TodoListScope` and replace the value with `<ClientId>/access_as_user`, i.e `986b487b-6dc0-492c-8b18-6224e35c5096/access_as_user`.
182+
1. and replace the value with the scope of the TodoListClient-and-Service application copied from the app registration in the **Expose an API** tab, i.e `https://contoso.onmicrosoft.com/TodoListClient-and-Service/access_as_user`.
183183
1. [Optional] If you changed the default URL for your service application, find the app key `todo:TodoListBaseAddress` and replace the value with the base address of the TodoListService project.
184184

185185
### Step 4: Run the sample
@@ -259,11 +259,12 @@ There is one change in the WebApp.Config, and one thing to check
259259
<add key="ida:Tenant" value="common"/>
260260
```
261261

262-
- the thing to draw your attention to, is that you now have the same client ID (Application ID) for the client application and the service. This is not usually the case, which is why your attention is especially drawn here. Therefore the GUID used in `ida:ClientId` is the same as the one used in the Application ID URI for the service: `todo:TodoListScope`
262+
- The thing to draw your attention to, is that you now have the same client ID (Application ID) for the client application and the service. This is not usually the case, which is why your attention is especially drawn here.
263+
- The scope must use the https pattern, because of [AzureADandPersonalMicrosoftAccount restrictions](https://docs.microsoft.com/en-us/azure/active-directory/develop/supported-accounts-validation)
263264

264265
```XML
265266
<add key="ida:ClientId" value="01234567-89ab-cdef-0123-456789abcdef"/>
266-
<add key="todo:TodoListScope" value="01234567-89ab-cdef-0123-456789abcdef/access_as_user"/>
267+
<add key="todo:TodoListScope" value="https://contoso.onmicrosoft.com/TodoListClient-and-Service/access_as_user"/>
267268
```
268269

269270
### Have the client let the user consent for the scopes required for the service

3.-Web-api-call-Microsoft-graph-for-personal-accounts/TodoListClient/App.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
for instance <GUID>/access_as_user, where <GUID> is the
3030
clientId of the application, created in the https://portal.azure.com portal.
3131
-->
32-
<add key="todo:TodoListScope" value="[Enter_client_ID_Of_TodoListClient-and-Service_from_Azure_Portal,_e.g._01234567-89ab-cdef-0123-456789abcdef]/access_as_user"/>
32+
<add key="todo:TodoListScope" value="[Enter_the_scope_of_TodoListClient-and-Service_registered_in_Azure_Portal,_e.g._https://contoso.onmicrosoft.com/TodoListClient-and-Service/access_as_user"/>
3333
<add key="todo:TodoListBaseAddress" value="https://localhost:44351/" />
3434
</appSettings>
3535
</configuration>

0 commit comments

Comments
 (0)