I've build a small graphQL api in asp.net core that gets some data from a Azure Cosmos database. Locally it runs fine with a CosmosEmulator.
If I connect the local running api directly to the CosmosDb running in Azure it works also fine.
When I deploy it through a devops pipeline, the graphQL api gives the following error:
GraphQL.ExecutionError: Error trying to resolve products.\r\n ---> Microsoft.Azure.Cosmos.CosmosException : Response status code does not indicate success: InternalServerError (500); Substatus: 0; ActivityId: 00000000-0000-0000-0000-000000000000; Reason: (An attempt was made to access a socket in a way forbidden by its access permissions.);\r\n ---> System.Net.Sockets.SocketException (10013): An attempt was made to access a socket in a way forbidden by its access permissions.\r\n at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)\r\n --- End of inner exception stack trace ---\r\n at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)\r\n--- Cosmos Diagnostics ---{\"DiagnosticVersion\":\"2\",\"Summary\":{\"StartUtc\":\"2020-11-16T19:32:58.2689693Z\",\"RunningElapsedTimeInMs\":137.7423,\"UserAgent\":\"cosmos-netstandard-sdk/3.12.0|3.11.4|03|X86|Microsoft Windows 10.0.14393|.NET Core 3.1.8|\",\"TotalRequestCount\":0,\"FailedRequestCount\":0},\"Context\":[]}\r\n --- End of inner exception stack trace ---
It seems that something between api and database isn't working but I can't figure it out. Should I change settings in the webapp configuration in Azure?