Skip to content

Commit 3eb1a68

Browse files
authored
Merge pull request #5699 from MicrosoftDocs/phecke-office365
Indicate OAuth is recommended
2 parents 1be2010 + 3548ba8 commit 3eb1a68

File tree

6 files changed

+58
-50
lines changed

6 files changed

+58
-50
lines changed

powerapps-docs/developer/data-platform/TOC.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,11 @@
410410
- name: Authenticate apps and services with Microsoft Dataverse
411411
href: authentication.md
412412
items:
413-
- name: .NET Framework applications
413+
- name: Authenticating .NET applications
414414
href: authenticate-dot-net-framework.md
415-
- name: Use OAuth
415+
- name: Use OAuth authentication
416416
href: authenticate-oauth.md
417-
- name: Use Office365 (WS-Trust)
417+
- name: Use of Office365 (WS-Trust) authentication
418418
href: authenticate-office365-deprecation.md
419419
- name: "Tutorial: Register an app with Azure Active Directory"
420420
href: walkthrough-register-app-azure-active-directory.md
Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
title: "Authenticating .NET Framework applications (Microsoft Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
2+
title: "Authenticating .NET applications (Microsoft Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
33
description: "Provides an overview of .NET based application authentication with Microsoft Dataverse web services." # 115-145 characters including spaces. This abstract displays in the search result.
44
ms.custom: ""
5-
ms.date: 03/23/2021
5+
ms.date: 01/06/2022
66
ms.reviewer: "pehecke"
77
ms.service: powerapps
88
ms.topic: "article"
@@ -17,14 +17,15 @@ search.app:
1717
- D365CE
1818
---
1919

20-
# Authenticating .NET Framework applications
20+
# Authenticating .NET applications
2121

22-
If you are using the .NET Framework when developing your application you can use classes within the [Xrm.Tooling](/dotnet/api/?view=dynamics-xrmtooling-ce-9) namespace to easily authenticate and connect to the Microsoft Dataverse web services.
22+
This topic provides guidance when developing applications coded and built using .NET.
2323

24-
`Xrm.Tooling` classes in the SDK assemblies use the <xref:Microsoft.Xrm.Sdk.IOrganizationService> interface methods. This is the same style of programming used by plug-ins and workflow activities, making it one style that you can use everywhere for .NET Framework applications. We recommend using the <xref:Microsoft.Xrm.Tooling.Connector>.<xref:Microsoft.Xrm.Tooling.Connector.CrmServiceClient> class for web service connection.
24+
## .NET Framework applications
25+
26+
If you are using the .NET Framework when developing your application you can use classes within the [Xrm.Tooling](/dotnet/api/) namespace to easily authenticate and connect to the Microsoft Dataverse web services.
2527

26-
> [!NOTE]
27-
> You may find older code or samples using the low-level <xref:Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy> or <xref:Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClient> classes. These remain supported and are not deprecated, but we recommend you use <xref:Microsoft.Xrm.Tooling.Connector.CrmServiceClient> for new .NET Framework client Applications.
28+
`Xrm.Tooling` classes in the SDK assemblies use the <xref:Microsoft.Xrm.Sdk.IOrganizationService> interface methods. This is the same style of programming used by plug-ins and workflow activities, making it one style that you can use everywhere for .NET Framework applications. We recommend using the <xref:Microsoft.Xrm.Tooling.Connector>.<xref:Microsoft.Xrm.Tooling.Connector.CrmServiceClient> class for web service connection.
2829

2930
The `Xrm.Tooling` classes provide many benefits including:
3031
- You can define connection information using a connection string.
@@ -42,29 +43,26 @@ If you want to use the Web API, you can use the <xref:Microsoft.Xrm.Tooling.Conn
4243
More information: [Build Windows client applications using the XRM tools](xrm-tooling/build-windows-client-applications-xrm-tools.md)
4344

4445

45-
## .NET Framework versions
46+
### .NET Framework versions
4647

47-
Use .NET Framework version 4.6.2 or higher when you create client applications. Only applications using Transport Level Security (TLS) 1.2 or better security can connect. TLS 1.2 is not the default protocol used by .NET Framework 4.5.2, but it is in .NET Framework 4.6.2.
48+
Use .NET Framework version 4.6.2 or higher when you create client applications. Only applications using Transport Level Security (TLS) 1.2 or better security can connect. TLS 1.2 is not the default protocol used by .NET Framework 4.5.2, but it is in .NET Framework 4.6.2 or later.
4849

49-
> [!IMPORTANT]
50-
> The SDK APIs available in [Microsoft.CrmSdk.XrmTooling.CoreAssembly](https://www.nuget.org/packages/Microsoft.CrmSdk.XrmTooling.CoreAssembly/) and other "CrmSdk" NuGet packages do not support .NET Core code development.<p/>
51-
> **Known Issue with Visual Studio 2015**
52-
>
53-
> When you are running your Visual Studio 2015 project/solution in debug mode, you may not be able to connect. This happens regardless of whether you are using a Target Framework of 4.6.2 or higher. This can occur because the Visual Studio hosting process is compiled against .NET 4.5 which means by default it does not support TLS 1.2. You can disable the Visual Studio hosting process as a work around.
54-
>
55-
> Right-click on the name of your project in Visual Studio and then click **Properties**. On the **Debug** tab you can uncheck the **Enable the Visual Studio hosting process** option.
56-
>
57-
> This only impacts the debug experience in VS 2015. This does not impact the binaries or executable that are built. The same issue does not occur in Visual Studio 2017.
58-
59-
## .NET Framework applications without SDK assemblies
50+
### .NET Framework applications without using SDK assemblies
6051

6152
If you prefer to not have a dependency on any SDK assemblies, you can also use the patterns described in [Use OAuth with Microsoft Dataverse](authenticate-oauth.md) without taking a dependency on any SDK assemblies. Without the SDK assemblies, you can only use the OData Restful web services (Web API and OData Global Discovery Service). The [Web API Data operations Samples (C#)](webapi/web-api-samples-csharp.md) demonstrate this approach.
6253

54+
## .NET Core and .NET 6 applications
55+
56+
The SDK APIs available in [Microsoft.CrmSdk.XrmTooling.CoreAssembly](https://www.nuget.org/packages/Microsoft.CrmSdk.XrmTooling.CoreAssembly/) and other "crmsdk" owned NuGet packages do not support .NET Core code development.
57+
58+
For .NET Core application development there is a `DataverseServiceClient` class, currently in preview release, that is patterned after the `CrmServiceClient` class mentioned previously. You can download the [Microsoft.PowerPlatform.Dataverse.Client](https://www.nuget.org/packages/Microsoft.PowerPlatform.Dataverse.Client/) package from Nuget.org to begin using this new service client class in your applications. Documentation and sample code for the `DataverseServiceClient` and related classes will be made available in a future documentation release.
59+
60+
To update existing .NET Framework based application code that uses `CrmServiceClient`, begin by substituting the `DataverseServiceClient` class for `CrmServiceClient` in your code. You will need to set the project type to build a .NET Core application, remove any .NET Framework specific references and NuGet packages, and then add the Microsoft.PowerPlatform.Dataverse.Client package to the project.
61+
6362
### See also
6463

6564
[Authentication with Dataverse web services](authentication.md)<br />
6665
[Use OAuth with Dataverse](authenticate-oauth.md)
6766

6867

69-
7068
[!INCLUDE[footer-include](../../includes/footer-banner.md)]

powerapps-docs/developer/data-platform/authenticate-office365-deprecation.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
title: "Use Office365 authentication with Microsoft Dataverse (Microsoft Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
2+
title: "Use of Office365 authentication with Microsoft Dataverse (Microsoft Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
33
description: "Describes deprecation of the WS-Trust security protocol and the code changes required in applications that use Office365 authentication."
44
ms.custom: ""
5-
ms.date: 09/20/2021
5+
ms.date: 01/06/2022
66
ms.reviewer: "pehecke"
77
ms.service: powerapps
88
ms.topic: "article"
@@ -17,18 +17,17 @@ search.app:
1717
- D365CE
1818
---
1919

20-
# Use Office365 authentication with Microsoft Dataverse
20+
# Use of Office365 authentication with Microsoft Dataverse
2121

22-
Use of the WS-Trust authentication security protocol when connecting to Microsoft Dataverse is no longer recommended and has been deprecated; see the [announcement](/power-platform/important-changes-coming#deprecation-of-office365-authentication-type-and-organizationserviceproxy-class-for-connecting-to-dataverse).
23-
24-
Additionally, the WS-Trust protocol does not support modern forms of multi-factor authentication and Azure AD Conditional Access controls to customer data.
22+
> [!IMPORTANT]
23+
> Use of the WS-Trust (Office365) authentication security protocol when connecting to Microsoft Dataverse is no longer recommended and has been deprecated; see the [announcement](/power-platform/important-changes-coming#deprecation-of-office365-authentication-type-and-organizationserviceproxy-class-for-connecting-to-dataverse).<p/>
24+
> Additionally, the WS-Trust protocol does not support modern forms of multi-factor authentication and Azure AD Conditional Access controls to customer data.
2525
26-
This change impacts custom client applications that use “Office365” authentication and the
26+
This document describes the impact to and required authentication code changes for custom client applications that use “Office365” authentication and the
2727
[Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy](/dotnet/api/microsoft.xrm.sdk.client.organizationserviceproxy) or
2828
[Microsoft.Xrm.Tooling.Connector.CrmServiceClient](/dotnet/api/microsoft.xrm.tooling.connector.crmserviceclient)
2929
classes. If your applications use this type of authentication protocol and API,
30-
continue reading below to learn more about the recommended authentication
31-
changes to be made to your application’s code.
30+
continue reading below to learn more about the recommended authentication changes to be made to your application’s code.
3231

3332
## How do I know if my code or application is using WS-Trust?
3433

@@ -50,9 +49,9 @@ using (OrganizationServiceProxy organizationServiceProxy =
5049
{ ... }
5150
```
5251

53-
- If you are using the `OrganizationServiceProxy` class at all in your code, you are using WS-Trust.
52+
- If your code uses the `OrganizationServiceProxy` class at all, you are using WS-Trust.
5453

55-
- If you are using [CrmServiceClient](/dotnet/api/microsoft.xrm.tooling.connector.crmserviceclient).`OrganizationServiceProxy` in your code, you are using WS-Trust.
54+
- If your code is using [CrmServiceClient](/dotnet/api/microsoft.xrm.tooling.connector.crmserviceclient).`OrganizationServiceProxy`, you are using WS-Trust.
5655

5756
## What should I do to fix my application code if affected?
5857

@@ -61,7 +60,7 @@ the recommended connection interface for authentication with Dataverse.
6160

6261
- If your code uses an [Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy](/dotnet/api/microsoft.xrm.sdk.client.organizationserviceproxy) instance:
6362

64-
If you are passing the `OrganizationServiceProxy` instance around to various methods, or returning the instance from a method, replace all occurrences of the type `OrganizationServiceProxy` with the [IOrganizationService](/dotnet/api/microsoft.xrm.sdk.iorganizationservice?view=dynamics-general-ce-9) interface. This interface exposes all the core methods used to communicate with Dataverse.
63+
If you are passing the `OrganizationServiceProxy` instance around to various methods, or returning the instance from a method, replace all occurrences of the type `OrganizationServiceProxy` with the [IOrganizationService](/dotnet/api/microsoft.xrm.sdk.iorganizationservice) interface. This interface exposes all the core methods used to communicate with Dataverse.
6564

6665
When invoking the constructor, it is recommend you add the NuGet package [Microsoft.CrmSdk.XrmTooling.CoreAssembly](https://www.nuget.org/packages/Microsoft.CrmSdk.XrmTooling.CoreAssembly/) to your project and replace all use of `OrganizationServiceProxy` class constructors with [CrmServiceClient](/dotnet/api/microsoft.xrm.tooling.connector.crmserviceclient) class constructors. You will need to alter your coding pattern here, however, for simplicity `CrmServiceClient` supports connection strings in addition to complex constructors and the ability to provide external authentication handlers. `CrmServiceClient` implements `IOrganizationService`, therefore your new authentication code will be portable to the rest of your application code. You can find examples on the use of `CrmServiceClient` in the [PowerApps-Samples](https://github.com/microsoft/PowerApps-Samples/tree/master/cds/orgsvc/C%23) repository.
6766
@@ -71,7 +70,7 @@ the recommended connection interface for authentication with Dataverse.
7170

7271
`connectionString = "AuthType=Office365;Username=jsmith@contoso.onmicrosoft.com;Password=passcode;Url=https://contoso.crm.dynamics.com"`
7372
74-
Similarly, you could also use a `CrmServiceClient` constructor and pass in `AuthType.Office365`.
73+
Similarly, you could also be using a `CrmServiceClient` constructor and pass in `AuthType.Office365`.
7574

7675
You have two options for dealing with this.<p/>
7776

@@ -85,15 +84,15 @@ the recommended connection interface for authentication with Dataverse.
8584

8685
The AppId and RedirectUri provided above are examples of working application registration values. These values work everywhere our online services are deployed. However, they are provided here as examples and you are encouraged to [create your own application registration](walkthrough-register-app-azure-active-directory.md) in Azure Active Directory (Azure AD) for applications running in your tenant. Use your Username, Password, and Dataverse environment URL values in the connection string along with the RedirectUri and AppId you obtain from your Azure app registration.<p/>
8786

88-
- When we announce it, update to the latest [Microsoft.CrmSdk.XrmTooling.CoreAssembly](https://www.nuget.org/packages/Microsoft.CrmSdk.XrmTooling.CoreAssembly/) NuGet package that includes auto redirect support. This library will redirect an authentication type of Office365 to OAuth and use the example AppId and Redirect URI automatically. This capability is planned for the 9.2.x version of the Microsoft.CrmSdk.XrmTooling.CoreAssembly package.
87+
- When we announce it, update to the latest [Microsoft.CrmSdk.XrmTooling.CoreAssembly](https://www.nuget.org/packages/Microsoft.CrmSdk.XrmTooling.CoreAssembly/) NuGet package that includes auto redirect support. This library will redirect an authentication type of "Office365" to "OAuth" and use the example AppId and Redirect URI automatically. This capability is planned for the 9.2.x version of the Microsoft.CrmSdk.XrmTooling.CoreAssembly package.
8988
9089
- If you are accessing the [CrmServiceClient](/dotnet/api/microsoft.xrm.tooling.connector.crmserviceclient).`OrganizationServiceProxy` property:
9190

9291
Remove all use of that property in your code. `CrmServiceClient` implements `IOrganizationService` and exposes everything that is settable for the organization service proxy.
9392

9493
> [!IMPORTANT]
9594
> Regarding not being able to login using User ID/Password even if using OAuth: if your tenant and user is configured in Azure Active Directory for conditional access and/or Multi-Factor Authentication is required, you will not be able to use user ID/password flows in a non-interactive form at all. For those situations, you must use a Service Principal user to authenticate with Dataverse.<p/>
96-
To do this, you must first register the application user (Service Principal) in Azure Active Directory. You can find out how to do this [here](/azure/active-directory/develop/howto-create-service-principal-portal). During application registration you will need to create that user in Dataverse and grant permissions. Those permissions can either be granted directly or indirectly by adding the application user to a team which has been granted permissions in Dataverse. You can find more information on how to set up an application user to authenticate with Dataverse [here](./use-single-tenant-server-server-authentication.md).
95+
To do this, you must first register the application user (Service Principal) in Azure Active Directory. You can find out how to do this [here](/azure/active-directory/develop/howto-create-service-principal-portal). During application registration you will need to create that user in Dataverse and grant permissions. Those permissions can either be granted directly or indirectly by adding the application user to a team which has been granted permissions in Dataverse. You can find more information on how to set up an unlicensed "application user" to authenticate with Dataverse [here](./use-single-tenant-server-server-authentication.md).
9796

9897
## Need help?
9998

powerapps-docs/developer/data-platform/authentication.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Authenticate with Microsoft Dataverse web services (Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
33
description: "Introduces authentication options that depend on the software framework you use." # 115-145 characters including spaces. This abstract displays in the search result.
44
ms.custom: ""
5-
ms.date: 03/23/2021
5+
ms.date: 01/06/2022
66
ms.reviewer: "pehecke"
77
ms.service: powerapps
88
ms.topic: "article"
@@ -23,9 +23,9 @@ How you authenticate depends on the software framework you use and which web ser
2323

2424
## .NET Framework applications
2525

26-
If your client application uses the .NET Framework, you have two options:
26+
If your client application uses the .NET Framework, you have two authentication options:
2727

28-
- OAuth
28+
- OAuth (recommended)
2929
- Microsoft 365
3030

3131
### OAuth
@@ -41,16 +41,18 @@ More information: [Use OAuth with Dataverse](authenticate-oauth.md)
4141

4242
### Microsoft 365
4343

44-
Microsoft 365 authentication requires using the .NET Framework SDK assemblies with the SOAP web services only.
44+
Microsoft 365 authentication (referred to as Office365 in code) requires using the .NET Framework SDK assemblies with the SOAP web services only.
4545

4646
Using Microsoft 365 authentication does not require that your register your applications as OAuth does. You must simply provide a User Principal Name (UPN) and password for a valid user.
4747

48-
More information: [Authentication with .NET Framework applications](authenticate-dot-net-framework.md), [Use of Microsoft 365 authentication with the WS-Trust security protocol](authenticate-office365-deprecation.md)
48+
More information: [Authentication with .NET Framework applications](authenticate-dot-net-framework.md)
49+
50+
> [!IMPORTANT]
51+
> Microsoft 365 authentication for Dataverse is deprecated. More information: [Use of Office365 authentication with Microsoft Dataverse](authenticate-office365-deprecation.md)
4952
5053
## All other software frameworks
5154

52-
If you are using anything other than .NET Framework, you must authenticate using OAuth and you must use the OData RESTful
53-
web services (Web API and OData global Discovery service).
55+
If you are using anything other than .NET Framework, you must authenticate using OAuth and you must use the OData RESTful web services (Web API and OData global Discovery service).
5456

5557
More information: [Use OAuth with Dataverse](authenticate-oauth.md)
5658

powerapps-docs/developer/data-platform/xrm-tooling/sample-simplified-connection-quick-start.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,18 @@ The following shows a sample `app.config file`. To use this, remove the comment
4646
<?xml version="1.0" encoding="utf-8"?>
4747
<configuration>
4848
<connectionStrings>
49-
<!-- Online using Microsoft 365 -->
50-
<!-- <add name="Server=CRM Online, organization=contoso, user=someone"
51-
connectionString="Url=https://contoso.crm.dynamics.com; [email protected]; Password=password; authtype=Office365"/> -->
49+
50+
<!--<add name="Connect"
51+
connectionString="
52+
AuthType=OAuth;
53+
54+
Url=https://contosotest.crm.dynamics.com;
55+
Password=passcode;
56+
AppId=51f81489-12ee-4a9e-aaae-a2591f45987d;
57+
RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97;
58+
TokenCacheStorePath=d:\MyTokenCache;
59+
LoginPrompt=Auto"/>-->
60+
5261
</connectionStrings>
5362
<startup>
5463
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />

0 commit comments

Comments
 (0)