Can I force Cloudflare worker region? So that it works with a specific Microsoft Azure API?

Hello,

I have a Cloudflare worker setup that calls an external Microsoft Azure API. It works locally (wrangler dev) but not from ther published endpoint. I receive the following error from Microsoft:

“Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource.”

After reading through the MS documentation, I found that I must call the API from the same region I created my subscription key from (US West 2). Since I live in US West area, I’m assuming that the local testing works since the request comes from there, but since I don’t know where the published Cloudflare worker is executing, MS is rejecting it.

So my question - can I force the external API to route through a certain region?

Do you think I would be better off spinning up an Azure Function? I’m really enjoying Cloudflare workers and am bummed with this error!

Thank you!

1 Like