Hello @Ramana Kumar, Jampana,
The unauthorized exception you are experiencing with Azure Managed Identity during initial requests may be related to the timing of when the identity is assigned and ready for use. In some cases, the application may attempt to authenticate before the managed identity is fully assigned or available, which can lead to authentication errors. This situation can resolve itself after a short period as the identity becomes available.
To mitigate this issue, ensure that the pod or service is correctly labeled and that you are handling potential exceptions, such as CredentialUnavailableException
, which indicates that the credential can't authenticate due to lack of configuration or setup. Additionally, implementing a retry mechanism can help manage these initial failures.