You're encountering the error:
"Custom Connector Service Principal Connection API registration error: Parameter 'token:clientId' is not allowed on the connection since it was not defined as a connection parameter when the API was registered."
This happens when trying to authenticate a custom connector in Power Automate using a service principal instead of a user-based OAuth connection. You've correctly identified that the issue lies in how the Swagger/OpenAPI definition is registered and how connection parameters are declared.
🔍 Root Cause
The error indicates that Power Automate is rejecting the token:clientId parameter because it wasn't declared as a connection parameter during the connector registration. Even though you added x-ms-connection-parameters to your Swagger file, Power Automate still doesn't recognize it—suggesting that the connector registration process didn’t properly bind those parameters to the authentication scheme .
✅ Recommended Fixes
1. Use x-ms-connection-parameters with x-ms-connector-authentication
You need to define both the connection parameters and the authentication scheme in your Swagger file. Here's a working pattern:
x-ms-connector-authentication:
type: "oauth2"
identityProvider: "aad"
clientId: "your-client-id"
clientSecret: "your-client-secret"
tenantId: "your-tenant-id"
scope: "https://graph.microsoft.com/.default"
parameters:
- name: "clientId"
type: "string"
- name: "clientSecret"
type: "securestring"
- name: "tenantId"
type: "string"
Make sure these parameters are also declared under x-ms-connection-parameters with proper UI definitions .
2. Avoid Using token: Prefix
The prefix token: is reserved for internal use and should not be manually added. Instead, define your parameters as clientId, clientSecret, and tenantId without the token: prefix.
3. Use Azure Managed Identity or OAuth 2.0 with Client Credentials
If you're using a service principal, ensure your connector uses OAuth 2.0 with client credentials flow. Power Automate currently has limited support for service principal authentication in custom connectors .
🏷️ Tag me if you have any further questions or if the issue persists.
✅ Click "Accept as Solution" if my post helped resolve your issue—it helps others facing similar problems.
❤️ Give it a Like if you found the approach useful in any way.