Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
You can set up the SAP OData connector for Power Platform to use Microsoft Entra ID credentials for single sign-on (SSO) to SAP. By using this method, your users can access SAP data in Power Platform solutions without signing in multiple times to multiple services. The solution respects their authorizations and assigned roles in SAP.
This article walks you through the process, including setting up a trust between SAP and Microsoft Entra ID and configuring Azure API Management to convert the Microsoft Entra ID OAuth token to a SAML token that's used to make OData calls to SAP.
For additional insights and context into the setup process, see the blog post Hurray! SAP OData connector now supports OAuth2 and SAP Principal Propagation.
Prerequisites
Before you begin the setup process, make sure you have the following resources in place:
- SAP instance
- Microsoft Entra ID
- Azure API Management (APIM) resource
- Admin privileges:
- SAP Basis admin
- Microsoft Entra ID – cloud or app admin
Named values
This section lists named values to make the examples easier to follow. These values are reused throughout the article and referenced in later sections. When following the examples in this article, be sure to replace the named values with your own values.
| Name | Sample value | Description |
|---|---|---|
AADSAPResource |
https://SAP_SAML_Client100 |
SAP local provider name; must be URI-compliant |
AADTenantId |
A GUID | Azure Tenant Id |
APIMAADRegisteredAppClientId |
A GUID | Microsoft Entra ID application (client) ID |
APIMAADRegisteredAppClientSecret |
Microsoft Entra ID client secret | |
APIMUserAssignedManagedIdentityId |
A GUID | APIM user-assigned managed identiy client ID |
SAPOAuthClientID |
OAUTH-JAMES |
SAP user |
SAPOAuthClientSecret |
SAP user password | |
SAPOAuthRefreshExpiry |
3600 | SAP token lifetime in seconds |
SAPOAuthScope |
ZAPI_BUSINESS_PARTNER_0001 |
SAP OAuth service scope |
SAPOAuthServerAddressForTokenEndpoint |
10.0.0.79:44301 |
SAP internal IP address: port number |
UserEmail |
james@contoso.com | The account used for SSO in Power Platform; the same email linked to the SAP User |
| OData Base URI | https://apim-sap-rn.azure-api.net/hao/sap/opu/odata/sap |
APIM-based URL used in the connections |
| Microsoft Entra ID Resource URI (Application ID URI) | api://b0133ffc-4d2a-4251-bf5e-c159d41486ed |
Microsoft Entra ID application ID URI, used in the connection |
| SAP NetWeaver Enterprise Application Client ID | A GUID | Application ID of SAP NetWeaver Enterprise Application in Azure |
Step 1: Download local provider SAML metadata from SAP
Set up a trust relationship between SAP and Microsoft Entra ID using SAML 2.0. To get started, download the SAP SAML 2.0 metadata XML file. As an SAP Basis admin, take these steps in SAP GUI:
- Run the transaction code
SAML2to open the SAP client-dependent SAML 2.0 configuration wizard. If you need to enable SAML 2.0, go to the SAP Help Portal. - Select the Local Provider tab, and save the SAP local provider name,
AADSAPResource, by following the sample value guidance in the named values table. It must be URI-compliant. - Select Metadata and then select Download Metadata. You'll upload the SAP SAML metadata XML file to Microsoft Entra ID in a later step.
Important
Microsoft Entra ID requires that the value of Provider Name be URI-compliant. If Provider Name is already set but isn't URI-compliant, don't change it without first consulting your SAP Basis team. Changing the value of Provider Name can break existing SAML configurations. The steps for changing it are beyond the scope of this article. Check with your SAP SAML Basis team for guidance.
For more information, see SAP's official documentation.
Step 2: Import SAP SAML metadata XML into Microsoft Entra ID enterprise application
Create a Microsoft Entra ID enterprise application and import the SAP SAML 2.0 metadata XML file. As a Microsoft Entra ID administrator, take these steps in the Azure portal:
Create Microsoft Entra ID enterprise application:
- Search for and select Microsoft Entra ID.
- In the left navigation pane, expand Manage > Enterprise applications.
- Select New application.
- Search for SAP Netweaver.
- Enter a name for the enterprise application, select Create, and save the Application (client) ID as SAP NetWeaver Enterprise Application Client ID as seen in the named values table.
Import the SAP SAML 2.0 metadata XML file:
- Go to Single sign-on and select SAML.
- Select Upload metadata file and upload the SAP SAML metadata XML file.
- Select Add.
- Verify that the Identifier (Entity ID) matches the value of
AADSAPResource. This value is case-sensitive. - Update the Reply URL (Assertion Consumer Service URL) to the SAP OAuth token endpoint in the following format:
https://<SAP server>:<port>/sap/bc/sec/oauth2/token?sap-client=<client ID>. - Update the Sign-on URL to any URI-compliant value. SAP doesn't use this value.
- Select Save.
Confirm the correct attribute is set:
- Go to the Attributes & Claims section.
- Select Edit.
- Confirm that Claim name Unique User Identifier (Name ID) is set to
user.userprincipalname[nameid="{email address}"].
Download the certificates:
Go to the SAML Certificates section.
Select the download links for:
- Certificate (Base64).
- Federation Metadata XML.
Add users and groups:
- Go to the Users and groups section.
- Select Add users/group.
- Select Users and groups.
- Search and select ALL Company and then select assign.
Step 3: Configure Microsoft Entra ID as a trusted identity provider for OAuth 2.0 in SAP
Configure SAP to allow Microsoft Entra ID to issue tokens for SAP OAuth 2.0 authentication. As an SAP Basis admin, take these steps in SAP GUI:
- Run transaction
SAML2. - Select the Trusted Provider tab, and then choose Oauth2.0 Identify provider.
- Select Add, choose Upload Metadata File, and upload the Federation Metadata XML file and the Certificate (Base64) file that you downloaded from Microsoft Entra ID.
- Save the configuration, select Edit, and then select Add.
- Select Email as the supported NameID format, then save and enable the provider.
Step 4: Create and map an SAP user to the Microsoft Entra ID user
Create and map an SAP user that maps to the Microsoft Entra ID user (james@contoso.com) who uses SSO from Power Platform. As an SAP Basis admin, take these steps in SAP GUI:
- Run transaction SU01 to create a new user.
- Enter a Last Name (for example, OAUTH-JAMES). Save this value as "SAPOAuthClientID" in the named values table.
- Enter james@contoso.com as the Email address.
- Select the Logon Data tab, set User Type to System.
- Create a password for the user. Save this password as
SAPOAuthClientSecretas seen in the named values table.
Step 5: Create an OAuth 2.0 client in SAP
Create an OAuth 2.0 client in SAP so Azure API Management can get tokens on behalf of users. As an SAP Basis admin, follow these steps in SAP GUI:
Run transaction
SOAUTH2.Select Create.
On the Client ID page:
- Go to OAuth 2.0 Client ID and select the SAP system user:
OAUTH-JAMES. - Enter a description, and then select Next.
- Go to OAuth 2.0 Client ID and select the SAP system user:
On the Client Authentication page, select Next.
On the Grant Type Settings page:
- Go to Trusted OAuth 2.0 IdP and select the Microsoft Entra ID entry.
- Select Refresh Allowed, and then select Next.
On the Scope Assignment page, select Add and choose the OData services that Azure API Management uses (for example,
ZAPI_BUSINESS_PARTNER_0001), and then select Next. SaveZAPI_BUSINESS_PARTNER_0001asSAPOAuthScopeas seen in the named values table.Select Finish.
For more information, see the SAP documentation and SAP's official documentation about SAP NETWEAVER for additional details.
Step 6: Register the Microsoft Entra ID application
Register the Microsoft Entra ID application that represents the Azure API Management resource and grants access to the Microsoft Power Platform SAP OData connector. By using this application, Azure API Management can exchange OAuth tokens for SAML tokens.
As a Microsoft Entra ID administrator, take these steps in the Azure portal:
Name and register the application:
- Select Microsoft Entra ID > App registrations > New Registration.
- Enter a Name, and then select Register. Save the client ID as
APIMAADRegisteredAppClientIdas seen in the named values table. - Go to Certificates & secrets, select New client secret, enter a description, and select Add. Save the secret value as
APIMAADRegisteredAppClientSecretas seen in the named values table.
Configure API permissions:
- Select API Permissions > Add a permission.
- Select Microsoft APIS > Microsoft Graph > Delegated permissions, search for and select openid, and then select Add permissions.
- Select Add a permission again.
- Select APIs my organization uses > search for the SAP NetWeaver application you created earlier, and select user_impersonation.
- Return to the API permissions page and select Grant admin consent for both permissions.
Expose the API for Azure API Management:
Select Expose an API.
Next to Application ID URI, select Add, accept the default value, and select Save. Save this value as "Microsoft Entra ID Resource URI (Application ID URI)" in the named values table.
Select Add a scope and take these steps:
- Set Scope name to user_impersonation.
- Set Who can consent? to Admins and users, and then selectAdd scope.
Authorize Azure API Management and the Microsoft Power Platform SAP OData connector:
- On the Expose an API page, select Add a client application.
- Enter the "SAP NetWeaver Enterprise Application Client ID" from named values table, check Authorized sopes, and then select Add application.
- Select Add a client application again.
- Enter
6bee4d13-fd19-43de-b82c-4b6401d174c3as the Client ID, check Authorized scopes, and then select Add application. This is the client ID of the Power Platform SAP OData connector.
Step 7: Create a user-assigned managed identity for Azure API Management
Create a user-assigned managed identity and assign it to your Azure API Management instance.
By using a user-assigned managed identity with Azure API Management, the platform handles authentication automatically, eliminating the need to manage or rotate APIMAADRegisteredAppClientSecret.
As a Microsoft Entra ID administrator, take the following steps in the Azure portal:
Create a user-assigned managed identity:
- Select Create a resource > search for and select User Assigned Managed Identity by Microsoft
- Enter the name and resource group, and then select Review + create. Save the Client ID as
APIMUserAssignedManagedIdentityIdas seen in the named values table.
Assign the managed identity to Azure API Management:
- Open your Azure API Management instance.
- Go to Security > Managed identities.
- Select the User assigned tab, select Add, choose the managed identity you created, and then select Add.
Step 8: Configure Azure API Management
Import the SAP OData metadata into Azure API Management, and then apply an API Management policy to handle token conversion. As a Microsoft Entra ID administrator, take the following steps in the Azure portal:
Retrieve the SAP OData metadata:
- Call the SAP service metadata endpoint. For example:
https://<SAPendpoint>:<port>/sap/opu/odata/sap/API_BUSINESS_PARTNER/$metadata. The exact URL depends on your SAP service configuration. - Save the response as an SAP OData metadata XML file.
- Call the SAP service metadata endpoint. For example:
Import the OData API into Azure API Management:
- Open your Azure API Management instance.
- Select APIs > Add API > OData.
- Upload the SAP OData metadata XML file.
- Enter a name and the API URL suffix. For example,
jms/sap/opu/odata/sap. - Save the Base URL as "Odata Base URI" in the named values table.
- Under All APIs, verify that your API (for example, API_BUSINESS_PARTNER_Entities) appears and that the entity sets and functions are listed.
Configure named values:
- In APIs, select Named values.
- Add the following key/value pairs that are in the named values table:
AADSAPResource,AADTenantId,APIMAADRegisteredAppClientId,APIMAADRegisteredAppClientSecret,APIMUserAssignedManagedIdentityId,SAPOAuthClientID,SAPOAuthClientSecret,SAPOAuthRefreshExpiry,SAPOAuthScope,SAPOAuthServerAddressForTokenEndpoint.
Note
Be aware that the settings differ slightly for SAP SuccessFactors. For more information, see Azure API Management policy for SAP SuccessFactors.
Step 9: Apply the Azure API Management token policy
Use Azure API Management policies to convert a Microsoft Entra ID–issued token into a token accepted by SAP NetWeaver. For more information, see official SAP documentation.
As a Microsoft Entra ID administrator, take the following steps:
Copy the Azure API Management policy from the Microsoft GitHub repository: Azure API Management policy.
Sign in to the Azure portal.
Open your Azure API Management resource.
Select APIs, and then select the OData API you created earlier.
Select All operations.
In the Inbound processing section, select Policies </>.
Replace the existing policy with the policy that you copied.
Select Save.
Related content
- SAP OData connector
- SAP OData connector now supports OAuth2 and SAP Principal Propagation | Power Automate community blog
- Azure API Management policy for SAP SuccessFactors | GitHub
- SAP OData connector for SAP SuccessFactors | SAP community blog
- The SAP Business Accelerator Hub also offers content related to the SAP integration suite policy for SuccessFactors and NetWeaver. You must have an SAP account to access this content.