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.
Register an OAuth client and connect Microsoft Advertising MCP Server to supported AI clients, including Copilot Studio, GitHub Copilot in VS Code, ChatGPT, and Claude. No prior experience with MCP servers or developer tools is required.
Overview
Microsoft Advertising MCP uses Azure Active Directory (AAD) OAuth authentication to securely connect AI assistants to Microsoft Advertising data. Before connecting an AI client, you must create an AAD application registration and configure the required authentication settings.
Prerequisites
Complete the following requirements before configuring any supported AI client.
Install Azure CLI
- Install Azure CLI.
- Close and reopen all terminal windows.
- Verify the installation:
az --version
- Sign in to Azure:
az login
- If you need to continue without an Azure subscription:
az login --allow-no-subscription
Create an AAD Application Registration
Create an application that supports both organizational and personal Microsoft accounts:
az ad app create --display-name "Ads MCP App" --sign-in-audience AzureADandPersonalMicrosoftAccount
Find the Client ID
Retrieve the application client ID:
az ad app list --display-name "Ads MCP App" --query "[].appId" --output tsv
Tip: The create command also returns the
appId. Save it when creating the application to avoid running a separate lookup command.
Set Up Your AI Client
Complete only the section for the AI client you intend to use. The same AAD application can be used to configure additional clients later.
Copilot Studio
Create the MCP Connector
- In Copilot Studio, go to Tools > New tool > Model Context Protocol.
- Enter a server name and description.
- Set the Server URL:
https://partner.api.bingads.microsoft.com/ext/mcp/vnext?toolSetNames=OpenBeta
- Set Authentication to OAuth 2.0 and Type to Manual.
- Enter the client ID from your AAD application.
Create a Client Secret
$clientId = '<client-id>'
az ad app credential reset --append --id $clientId --query password --output tsv
Important: Use the returned password as the Client Secret and store it securely. Do not share or expose this value.
OAuth Settings
| Setting | Value |
|---|---|
| Authorization URL | https://login.microsoftonline.com/common/oauth2/v2.0/authorize |
| Token URL | https://login.microsoftonline.com/common/oauth2/v2.0/token |
| Refresh URL | https://login.microsoftonline.com/common/oauth2/v2.0/token |
| Scopes | https://ads.microsoft.com/msads.manage offline_access |
Add the Connector to an Agent
- Create a new agent.
- Add the MCP connector as a tool.
- Create a connection and sign in with your Microsoft Advertising account.
- Save the configuration.
- Test the connection with a Microsoft Advertising prompt.
If prompted, refresh the connection and sign in again.
GitHub Copilot in VS Code
Open MCP User Configuration
- Open VS Code.
- Open the Command Palette.
- Select MCP: Open User Configuration.
Configure the Server
Replace <client-id> with your application client ID:
{
"servers": {
"microsoft-ads-mcp": {
"url": "https://partner.api.bingads.microsoft.com/ext/mcp/vnext?toolSetNames=OpenBeta",
"type": "http",
"oauth": {
"clientId": "<client-id>"
}
}
}
}
Verify the Connection
- Save
mcp.json. - Start the MCP server.
- Complete sign-in.
- Open GitHub Copilot Chat in Agent mode.
- Confirm the server is running.
Example prompts:
- What customers do I have access to in Microsoft Advertising?
- Show my Microsoft Advertising user information.
ChatGPT
Enable Developer Mode
- Navigate to Workspace Settings > Plugins > Developer mode.
- Enable Developer Mode.
Business, Enterprise, and Education workspaces require an administrator to enable Developer Mode.
Create a Connector
- Create a new plugin or connector.
- Enter a connector name.
- Set the server URL:
https://partner.api.bingads.microsoft.com/ext/mcp/vnext
- Select OAuth authentication.
- Configure OAuth settings using your client ID.
OAuth Settings
| Setting | Value |
|---|---|
| Authorization URL | https://login.microsoftonline.com/common/oauth2/v2.0/authorize |
| Token URL | https://login.microsoftonline.com/common/oauth2/v2.0/token |
| Authorization Server Base | https://login.microsoftonline.com/common/oauth2/v2.0 |
| Resource | Leave empty |
| Scope | https://ads.microsoft.com/msads.manage |
Complete Setup
- Copy the generated Callback URL.
- Add it as a public client redirect URI in your AAD application.
- Create the connector.
- Sign in and grant consent.
- Test the connection.
Select "I understand and want to continue" when prompted.
Claude
Configure Redirect URI
Add Claude's OAuth callback URL as a public client redirect URI in the AAD application.
Add the Connector
- Go to Settings > Customize > Connectors.
- Select Add custom connector.
- Enter a name.
- Set the MCP Server URL:
https://partner.api.bingads.microsoft.com/ext/mcp/vnext?toolSetNames=OpenBeta
- Open Advanced Settings.
- Enter the OAuth client ID.
- Add the connector.
- Sign in and grant consent.
- Enable the connector in the conversation.
Troubleshooting
VS Code Broker Sign-In Error
If VS Code displays the following error:
Error getting token from server metadata: ClientAuthError:
platform_broker_error: An error occurred in the native broker.
See the platformBrokerError property for details.
Update the authentication implementation setting:
- Open File > Preferences > Settings.
- Search for
microsoft-authentication.implementation. - Change the value from:
msal
to:
msal-no-broker
- Restart the MCP server.
- Sign in again.
Next Steps
After configuration is complete, test your MCP connection by running a Microsoft Advertising query such as retrieving campaigns, customers, or account information through your selected AI client.