Obtaining connection values for Microsoft Azure OpenAI
About this task
The following steps describe how to obtain the connection values for Microsoft Azure OpenAI and to connect to App Connect.
Procedure
- Log in to the Microsoft Azure portal.
- To obtain the client ID and client secret (OAUTH 2.0
CREDENTIALS and BASIC OAUTH) values, complete the following
steps:
- Click App registrations.
- In the
App registrations
page, click New registration. - In the
Register an application
page, specify a unique name for your app. - Select an option in the Supported account types section according to your
requirements:
For the OAUTH 2.0 CREDENTIALS authorization type, select the Single tenant option.
For the BASIC OAUTH authorization type, select one of the Multitenant options.

- Click Register.
The Overview page for the application is displayed.

- Make a note of the Application (client) ID value because you need to specify it as a connection value when creating the account in App Connect.
- For the Client credentials field on the Overview
page, click Add a certificate or secret. This action opens the
Certificates & secrets
page.
- Click + New client secret.
- In the
Add a client secret
panel, specify a description for the secret (for example, App Connect secret) and then select an expiry period. - Click Add.
The generated client secret is displayed on the
Certificates & secrets
page.
- Copy and store the client secret value. You need to specify this value as a connection value
when you create the account in App Connect.Note: The client secret value is not shown again in full after you exit this page.
- To configure the permissions that App Connect needs,
complete the following steps:
- Click App registrations.
- Select the application that you created in step 2.
- Click Manage.
- Click API permissions on the sidebar.
- Click +Add a permission.
- Select Microsoft Cognitive Services.
- Select user_impersonation under Permissions.
- Click the Add permissions button.

- To find the tenant ID (OAUTH 2.0 CREDENTIALS) value,
complete the following steps:
- Go to the Microsoft Azure portal login page, and then go to Microsoft Entra ID > Properties.
- Copy the Tenant ID value and save it somewhere safe.

For more information about obtaining the Tenant ID, see How to find your Microsoft Entra tenant ID in the Microsoft Entra documentation.
- To create a new resource in Microsoft Azure OpenAI, complete the following steps:
- Log in to the Microsoft Azure portal.
- Click Azure OpenAI from the list of Azure Services.
- Click +Create, and then select Azure OpenAI.
- Choose the subscription in which you want to create the resource.
- Select a resource group from the menu, or click Create new to create a new resource group.
- In the Region field, choose the region to host your resource.
- Enter the name for your resource in the Name field.
- In the Pricing tier field, select the required pricing tier.
- Click Next.
- On the Networks tab, select the Type that you require.
- Click Next.
- On the Tags tab, configure the tags you require.
- Click Next.
- Review and confirm your settings, and then click Create.Tip: For more information about creating a resource, see Create a resource in the Microsoft Azure documentation.
- To grant your application access to the Azure Open AI resource by using Azure role-based
access control (Azure RBAC), assign the Cognitive Services OpenAI Contributor and Cognitive Services
OpenAI User roles to the application.
- Go to the Microsoft Azure portal, and then click Azure OpenAI from the list of Azure Services.
- Select the Azure OpenAI resource that you created in step 5.
- Click Access control (IAM) on the sidebar.
- Click +Add, and then select Add role
assignment.
The Add role assignment page is displayed.
- In the Role field, select Cognitive Services OpenAI Contributor and Cognitive Services OpenAI User from the list.
- In the Members section, select the application that you created in step 2.
- Click Review + assign.Tip: For more information about assigning a role, see Add role assignment to an Azure OpenAI resource in the Microsoft Azure documentation.
- To obtain the Server URL and the API key (API KEY), complete the
following steps:
- Go to the Microsoft Azure portal.
- Click Azure OpenAI from the list of Azure Services.
- Select the resource that you created in step 5.
- Click Go to Foundry portal.

- Copy your API key value and save it somewhere safe.
- Copy the Azure OpenAI endpoint (this is your Server URL) value and save it somewhere safe.
- If you want to connect by using BASIC
OAUTH authorization, use an application to submit a POST request to generate an access
token and a refresh token that will be used to interact with Microsoft Azure OpenAI on your behalf. Before you can request an access
token, you must authorize your application.
To authorize the application, complete the following steps:
- Open a browser window, and then go to the authorization endpoint by using a URL in the following
format:Request URL:
GET https://login.microsoftonline.com/common/oauth2/v2.0/authorizeRequest parameters:Key Value client_id Set this to the Application (client) ID value that was generated for your registered app. response_type Set this to codeto indicate that the app is using the OAuth 2.0 authorization code flow.redirect_uri Set this to the redirect URI registered for your application. This value must exactly match one of the registered redirect URIs and must be URL encoded. For native and mobile apps, use the default value of https://login.microsoftonline.com/common/oauth2/nativeclient. scope A list of permissions, which are separated by spaces, that the user must consent to. For example, https://cognitiveservices.azure.com/.default offline_access response_mode Set this to specify how the authorization response is returned to the application. Valid values are queryorform_postorfragment.state Set this to a unique value to maintain request state and help protect against cross‑site request forgery (CSRF) attacks. - Enter your Microsoft account credentials, and then click Sign in.
- Review the permissions in the Permissions requested pop-up window and click
Accept.The browser is redirected to the configured redirect URI. For example:
GET http://localhost? code=AwABAAAAvPM1KaPlrEqdFSBzjqfTGBCmLdgfSTLEMPGYuNHSUYBrq... &state=12345 - Copy and save the value of the code query parameter in the redirected URL.
- Open a browser window, and then go to the authorization endpoint by using a URL in the following
format:
- To generate an access token and a refresh token (BASIC OAUTH),
submit a POST request to the token endpoint by specifying the following parameters:
- Token endpoint URL:
POST https://login.microsoftonline.com/common/oauth2/v2.0/token - Content-Type:
application/x-www-form-urlencoded - Request parameters:
Key Value client_id Set this to the Application (client) ID value that was generated for your registered app. scope A space-separated list of scopes. For example, https://cognitiveservices.azure.com/.default offline_access grant_type Set this to authorization_code client_secret Set this to the client secret value that was generated under Certificates & secrets for your registered app. code Set this to the code that you acquired in step 8. redirect_uri Set this to the same redirect URI used in step 8 .
- Token endpoint URL: