Search code examples
azure.net-core

Azure .Net API won't make outbound calls to private endpoints but locally everything works just fine


I have a .Net Core 6 API deployed to an Azure app service and it has connections to different azure resources (database/keyvault etc).

When testing the connections on localhost using the generated swagger file, every connection works just fine. Even running postman to my localhost swagger file works also. But for some reason, when testing the swagger document from my Azure API, only connections to the azure resources work, but not the private connections.

I get 502 BAD Gateway Error when calling private endpoint. Also, I get AspNetCoreModuleV2 Error in the Azure portal availability and performance overview.

I have tried changing the AspNetCoreModuleV2 to AspNetCoreModule in the cs.proj file, adding <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel> but these methods doesn't work.

I have also upgradey my service plan from S1 => S2, tested and downgraded again but it doesn't work.

Can somebody help?


Solution

  • It's a connectivity issue. Your "private endpoint" is behind a firewall. Your localhost is probably on the internal network.