Hello Amit Kumar, I understand that your application fails to authenticate with Azure Storage when running inside Azure Container Apps, even though the same image works fine on local machines and VMs. Most probably the authentication method used in your container app is not correctly configured or lacks the necessary permissions.
There are two ways to fix this.
Option 1 which I already suggested in comments is to enable managed identity on your container app.
Assign necessary permissions like acr pull and Storage Blob data contributor role. You can do this from the portal as well
Once assigned you can verify it from portal or CLI (Note: Permissions may take up to 15 minutes to propagate.)
Modify your code to explicitly use managed identity.
from azure.identity import ManagedIdentityCredential
from azure.storage.blob import BlobServiceClient
# Define Storage Account Name
STORAGE_ACCOUNT_NAME = "arkstorageacct"
BLOB_CONTAINER_NAME = "arkcontainer"
# Use Managed Identity for authentication
credential = ManagedIdentityCredential()
Few additional noteworthy checks I would like to suggest such as if your storage account has firewall rules, it might be blocking access from Azure Container Apps. Cross check that once.
Option 2
You can also try using default azure credential with client id.
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.