Forum Discussion

ronmzz's avatar
ronmzz
Copper Contributor
Jul 19, 2023

Using sp_invoke_external_rest_endpoint to call Graph API from Azure SQL

I've been using sp_invoke_external_rest_endpoint to call external APIs and for the most part it works great. But I'm having some challenges calling Graph.

 

One option I've used to call Graph is to have something external generate the access token and then pass that in the headers. Headers are limited to 4000 characters. That works great in my one environment where the access tokens are less than 4000 characters. But in another environment, they are greater than 4000 characters.

 

I tried creating a credential for the access token but the secret in a credential is also limited to 4000 characters!

 

I also tried using a user managed identity. I set up everything right, gave the enterprise app permissions to Graph, and it looks like the identity is being used, but I keep getting an "Access token validation failure. Invalid audience." error. I guess I need to set the audience/scope somewhere but I don't know how or where.

 

It seems like sp_invoke_external_rest_endpoint should allow longer headers, or credentials should allow longer secrets. 🙂 

 

Any suggestions? 

 

No RepliesBe the first to reply