This is quite a difficult issue to describe so please forgive me if I am not 100% clear.
I am replacing Microsoft.Azure.KeyVault with Azure.Security.KeyVault.Secrets since the former is now deprecated. The migration appears to have worked however all of my integration tests fail with a 404 error but only when run in our Azure pipeline. When run locally then all works as expected. The API server also works fine if I bypass the integration tests and allow it to deploy to Azure.
When running the integration tests we don’t actually use the Vault however if I add SecretClient to my DI registration but don’t actually use it anywhere then all tests still fail. Removing the DI registration for SecretClient makes the tests work again.
The tests are connecting to a local API server and each request fails with a 404 error. The tests use their own HttpClient singleton.
The test output from within the pipeline shows each test failing because of a 404 error. Enabling logging in the API server shows the incoming requests being rejected with a 404 error. Even a call to the Swagger endpoint of the server fails with a 404.
So it appears to be a general connectivity failure of some sort but which only happens when SecretClient (or any of the 3 replacement Azure Vault clients) are instantiated – but not actually used.
Has anyone experienced this? If so I would be forever grateful for the reason.
Thank you