Skip to content

Commit 8a6a65e

Browse files
authored
Merge pull request MicrosoftDocs#2249 from MicrosoftDocs/app-user
Updtates based on PM's feedback
2 parents fd9832d + e5cfee3 commit 8a6a65e

File tree

4 files changed

+79
-21
lines changed

4 files changed

+79
-21
lines changed
53.2 KB
Loading
1.15 MB
Loading
934 KB
Loading

powerapps-docs/developer/common-data-service/use-single-tenant-server-server-authentication.md

Lines changed: 79 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: "Use Single-Tenant server-to-server authentication (Common Data Service) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
33
description: "Describes how to access D365 data from an application or service without explicit user authentication." # 115-145 characters including spaces. This abstract displays in the search result.
44
ms.custom: ""
5-
ms.date: 2/21/2019
5+
ms.date: 12/20/2019
66
ms.reviewer: "pehecke"
77
ms.service: powerapps
88
ms.topic: "article"
99
author: "paulliew" # GitHub ID
10-
ms.author: "jdaly" # MSFT alias of Microsoft employees only
11-
manager: "ryjones" # MSFT alias of manager or PM counterpart
10+
ms.author: "pehecke" # MSFT alias of Microsoft employees only
11+
manager: "kvivek" # MSFT alias of manager or PM counterpart
1212
search.audienceType:
1313
- developer
1414
search.app:
@@ -17,9 +17,9 @@ search.app:
1717
---
1818
# Use Single-Tenant server-to-server authentication
1919

20-
The single-tenant server-to-server scenario typically applies for enterprise organizations who have multiple Common Data Service environments using Active Directory Federation Services (AD FS) for authentication. However, it can also be applied by environments when the application won't be distributed to other environments.
20+
The single-tenant server-to-server scenario typically applies for enterprise organizations that have multiple Common Data Service environments using Active Directory Federation Services (AD FS) for authentication. However, it can also be applied by environments when the application won't be distributed to other environments.
2121

22-
An enterprise can create a web application or service to connect to any Common Data Service environments associated with a single Azure Active Directory (AD) tenant.
22+
An enterprise can create a web application or service to connect to any Common Data Service environments associated with a single Azure Active Directory (Azure AD) tenant.
2323

2424
## Differences from multi-tenant scenario
2525
Creating a web application or service for a single-tenant server-to-server authentication is similar to that used for a multi-tenant organization but there are some important differences.
@@ -37,47 +37,105 @@ In the [See also](#bkmk_seealso) section at the end of this article, there are l
3737

3838
- An Azure AD tenant to use when registering the provided sample application.
3939
- A Common Data Service subscription that is associated with the Azure AD tenant.
40-
- Administrator privileges in the Azure AD tenant and D365 organization.
40+
- Administrator privileges in the Azure AD tenant and Common Data Service environment.
4141

4242
<a name="bkmk_registration"></a>
4343
## Azure application registration
4444
To create an application registration in Azure AD, follow these steps.
4545

46-
1. Navigate to https://admin.microsoft.com and sign in, or from your D365 organization web page select the application launcher in the top left corner.
46+
1. Navigate to https://admin.microsoft.com and sign in, or from your Common Data Service environment web page, select the application launcher in the top left corner.
4747
2. Choose **Admin** > **Admin centers** > **Azure Active Directory**
4848
3. From the left panel, choose **Azure Active Directory** > **App registrations (Preview)**
4949
4. Choose **+ New registration**
50-
5. In the **Register an application** form provide a name for your app, select **Accounts in this organizational directory only**, and choose **Register**. A redirect URI is not needed for this walkthrough and the provided sample code.<br /> ![Register an application form](media/S2S-app-registration-started.PNG)
51-
6. On the **Overview** page, select **API permissions** <br >![App registration permissions](media/S2S-app-registration-completed.PNG)
50+
5. In the **Register an application** form provide a name for your app, select **Accounts in this organizational directory only**, and choose **Register**. A redirect URI is not needed for this walkthrough and the provided sample code.
51+
52+
> [!div class="mx-imgBorder"]
53+
> ![Register an application form](media/S2S-app-registration-started.PNG)
54+
55+
6. On the **Overview** page, select **API permissions**
56+
57+
> [!div class="mx-imgBorder"]
58+
> ![App registration permissions](media/S2S-app-registration-completed.PNG)
59+
5260
7. Choose **+ Add a permission**
5361
8. In the **Microsoft APIs** tab, choose **Dynamics CRM**
54-
9. In the **Request API permission** form, select **Delegated permissions**, check **user_impersonation**, and select **Add permissions** <br />![Setting API permissions](media/S2S-api-permission-started.PNG)
55-
10. On the **API permissions** page below **Grant consent**, select **Grant admin consent for "org-name"** and when prompted choose **Yes** <br />![Granting API permissions](media/S2S-api-permission-completed.PNG)
62+
9. In the **Request API permission** form, select **Delegated permissions**, check **user_impersonation**, and select **Add permissions**
63+
64+
> [!div class="mx-imgBorder"]
65+
> ![Setting API permissions](media/S2S-api-permission-started.PNG)
66+
67+
10. On the **API permissions** page below **Grant consent**, select **Grant admin consent for "org-name"** and when prompted choose **Yes**
68+
69+
> [!div class="mx-imgBorder"]
70+
> ![Granting API permissions](media/S2S-api-permission-completed.PNG)
71+
5672
11. Select **Overview** in the navigation panel, record the **Display name**, **Application ID**, and **Directory ID** values of the app registration. You will provide these later in the code sample.
5773
12. In the navigation panel, select **Certificates & secrets**
5874
13. Below **Client secrets**, choose **+ New client secret** to create a secret
5975
14. In the form, enter a description and select **Add**. Record the secret string. You will not be able to view the secret again once you leave the current screen.
6076

6177
<a name="bkmk_appuser"></a>
6278
## Application User creation
63-
To create an unlicensed "application user" in your Dynamics 365 organization, follow these steps. This application user will be given access to your organization's data on behalf of the end user who is using your application.
64-
65-
1. Navigate to your Common Data Service organization
66-
2. Navigate to **Settings** > **Security** > **Users**
67-
3. Choose **Application Users** in the view filter
68-
4. Select **+ New**
69-
5. Change to the **Applcation User** form
70-
5. In the **Applcation User** form, enter the required information. The user information must not match a user that exists Azure Active Directory. <br />![New app user](media/S2S-new-appuser.PNG)
71-
6. If all goes well, after selecting **SAVE**, the **Application ID URI** and **Azure AD Object Id** fields will auto-populate with their correct values
79+
To create an unlicensed "application user" in your environment, follow these steps. This application user will be given access to your environment's data on behalf of the end user who is using your application.
80+
81+
1. Navigate to your Common Data Service environment (https://*[org]*.crm.dynamics.com).
82+
2. Navigate to **Settings** > **Security** > **Users**.
83+
3. Choose **Application Users** in the view filter.
84+
4. Select **+ New**.
85+
5. In the **Application User** form, enter the required information.
86+
87+
1. The user name information must not match a user that exists in the Azure Active Directory.
88+
1. In the **Application ID** field, enter the application ID of the app you registered earlier in the Azure AD.
89+
90+
> [!div class="mx-imgBorder"]
91+
> ![New app user](media/S2S-new-appuser1.png)
92+
93+
6. If all goes well, after selecting **SAVE**, the **Application ID URI** and **Azure AD Object Id** fields will auto-populate with correct values.
94+
95+
> [!div class="mx-imgBorder"]
96+
> ![New app user](media/S2S-new-appuser.PNG)
97+
7298
7. Before exiting the user form, choose **MANAGE ROLES** and assign a security role to this application user so that the application user can access the desired organization data.
7399

74100
> [!IMPORTANT]
75101
> When developing a real-world application using S2S, you should use a custom security role which can be stored in a solution and distributed along with your application.
76102
103+
## Enable or disable application users
104+
When application users are created, they are automatically enabled. The default Application User form shows the **Status** in the form footer; the **Status** field can't be updated.
105+
106+
In an event that an application user’s status is disabled and you need to enable it, you can perform the following steps to customize the Application User form to allow update to the **Status** field. You can also use these steps to disable an application user that is no longer used.
107+
108+
1. Remove the **Status** field from the Application User form footer.
109+
1. Navigate to your Common Data Service environment (https://*[org]*.crm.dynamics.com).
110+
1. Navigate to **Settings** > **Customizations** > **Customize the System**.
111+
1. In the left pane, select **Entities** > **User** > **Forms**.
112+
1. Select **Application User** in the list of forms
113+
1. Select **Footer** in the actions bar.
114+
1. Click on the Status grid, and then select Remove in the actions bar.
115+
116+
> [!div class="mx-imgBorder"]
117+
> ![Remove Status field from the Application User form](media/remove-status-app-user.png "Remove Status field from the Application User form")
118+
119+
1. Add the **Status** field to a new section in the body of the Application User form.
120+
1. Select **Body** in the actions bar.
121+
1. On the **Insert** tab, select **Section** > **One Column**.
122+
1. Under **Field Explorer** locate the **Status** field, and drag and drop the **Status** field into the new section area.
123+
124+
> [!div class="mx-imgBorder"]
125+
> ![Add Status field to the Application User form](media/add-status-app-user.png "Add Status field to the Application User form")
126+
127+
1. Save and publish the customizations
128+
129+
Now, you can navigate to the application user and update the **Status** field as required to enable or disable the application user.
130+
131+
> [!CAUTION]
132+
> Disabling an application user will break all the integration scenarios that use the application user.
133+
134+
77135
<a name="bkmk_coding"></a>
78136
## Application coding and execution
79137

80-
Follow these steps to download, build, and execute the sample application. The sample calls the WebAPI to return a list of the top 3 accounts (by name) in the organization.
138+
Follow these steps to download, build, and execute the sample application. The sample calls the Web API to return a list of the top 3 accounts (by name) in the organization.
81139

82140
1. Download the Visual Studio 2017 SingleTenantS2S [sample](https://github.com/Microsoft/PowerApps-Samples/tree/master/cds/webapi/C%23/SingleTenantS2S).
83141
2. Update the App.config file with your app registration and server key values.

0 commit comments

Comments
 (0)