Getting InvalidStorageAccountKey error while deploying ACI
I'm trying to deploy an ACI with a mounted Azure File but keep getting an error that the storage account key is invalid. For context. I have successfully deployed other ACIs with volumes hosted on the same storage account and using the same key without an issue. I've used YAML files, but for simplicity and as a test I also used Azure CLI to retrieve the key and deploy the container to rule out any typos and below is the command I used:
STORAGE_KEY=$(az storage account keys list --resource-group $ACI_PERS_RESOURCE_GROUP --account-name $ACI_PERS_STORAGE_ACCOUNT_NAME --query "[0].value" --output tsv)
WARNING: [Warning] This output may compromise security by showing secrets. Learn more at: https://go.microsoft.com/fwlink/?linkid=2258669
az container create --resource-group $ACI_PERS_RESOURCE_GROUP --name test-server --image lscr.io/linuxserver/prowlarr:latest --dns-name-label saturnz-barrz --ports 9696 --azure-file-volume-account-name $ACI_PERS_STORAGE_ACCOUNT_NAME --azure-file-volume-account-key $STORAGE_KEY --azure-file-volume-share-name prowlarr-config --azure-file-volume-mount-path /config/
Here is the error I keep getting no matter the method I use to deploy:
{
"status": "Failed",
"error": {
"code": "InvalidStorageAccountKey",
"message": "The Azure storage account key in volume 'azurefile' is invalid."
}
}
Azure Files
Azure Container Instances
Azure Storage Accounts
-
Sergio Castañeda 10 Reputation points • Microsoft Employee
2024-12-26T18:30:42.86+00:00 This seems to be a false positive returned by Log Analytics. I deleted and redeployed the ACIs that I had running and those returned the same error before successfully deploying.
-
Keshavulu Dasari 2,835 Reputation points • Microsoft Vendor
2024-12-27T02:22:38.1233333+00:00 Hi Sergio Castañeda,
Thanks for posting your query! especially since you've successfully deployed other ACIs with the same storage account and key,
I suggest few steps you can take to troubleshoot the issue.
Verify Storage Account Key Double-check that the storage account key you're using is correct. You can manually copy the key from the Azure portal to ensure there are no issues with theaz storage account keys list
command.- Key Permissions: Ensure that the storage account key has the necessary permissions. Sometimes, key permissions might be restricted or changed.
- Key Rotation: If the storage account key was recently rotated, make sure you're using the updated key.
- Azure CLI Version: Ensure that your Azure CLI is up to date. Sometimes, issues can arise from using an outdated version.
- Network Restrictions: Check if there are any network restrictions or firewall rules that might be affecting the storage account access.
- Resource Group and Account Names: Verify that the resource group and storage account names are correct and match exactly, including case sensitivity. Try deploying the ACI using the Azure portal or an ARM template to see if the issue persists.
If you are still facing issues, please provide some screenshots and details in the "comments" and I would be happy to help you
-
Keshavulu Dasari 2,835 Reputation points • Microsoft Vendor
2024-12-30T04:06:46.48+00:00 Hi Sergio Castañeda,
Just checking in to see if the response helped. If you have any questions, let me know in the "comments" and I would be happy to help you. -
Sergio Castañeda 10 Reputation points • Microsoft Employee
2024-12-30T17:44:16.71+00:00 Hi @Keshavulu Dasari Thank you for your reply and follow up. I'm still unable to deploy this particular image to ACI, however as I mentioned it seems the storage account key error is unrelated. I got the same error during a successful deployment of a different image. The error seems related to deploying a Log Analytics workspace intended to allow me to debug.I still need to test deploying a third image to confirm the issue is with the second image or with my particular setup. Thanks!
-
Keshavulu Dasari 2,835 Reputation points • Microsoft Vendor
2024-12-31T03:10:04.9966667+00:00 Hi Sergio Castañeda,
Given that the storage account key error appeared even during a successful deployment, it does seem like the problem might be related to the specific image or the Log Analytics workspace setup.
Few additional steps you might consider:
Test with a Third Image: As you mentioned, deploying a third image can help determine if the issue is specific to the second image or your setup.
Log Analytics Workspace Configuration: Double-check the configuration of your Log Analytics workspace. Ensure that it is correctly linked to your ACI and that all necessary permissions are in place.
Review Diagnostic Logs: Look into the diagnostic logs for both the ACI and the Log Analytics workspace. These logs can provide more detailed error messages that might help pinpoint the issue.
Image Compatibility: Verify that the image you are trying to deploy is compatible with ACI. Sometimes, specific images might have dependencies or configurations that need to be adjusted for ACI.
If you have any other questions or are still running into more issues, let me know in the "comments" and I would be happy to help you.
-
Sergio Castañeda 10 Reputation points • Microsoft Employee
2024-12-31T14:05:29.96+00:00 Could you please provide more details on how to review diagnostic logs for ACI? I can’t seem to find them and that is why I was trying to link the Log Analytics workspace which seems to be failing with the storage account key error. Thanks.
-
Sergio Castañeda 10 Reputation points • Microsoft Employee
2025-01-02T00:04:03.8966667+00:00 Same error using a different image. The error I see under Events is: Container prowlarr-server terminated with ExitCode 100.
-
Keshavulu Dasari 2,835 Reputation points • Microsoft Vendor
2025-01-02T09:27:16.9866667+00:00 Hi Sergio Castañeda,
To review diagnostic logs for Azure Container Instances, you can follow these steps:
- View Logs in Azure Portal:
- Navigate to your container instance in the Azure portal.
- Under the Monitoring section, select Logs. Here, you can view the logs generated by your container.
- Using Azure CLI:
- You can use the
az container logs
command to retrieve logs from your container instance. For example:az container logs --resource-group <your-resource-group> --name <your-container-name>
- This command will display the logs from your container, which can help you diagnose issues.
- You can use the
- Attach Output Streams:
- The
az container attach
command allows you to attach to the container's output streams (STDOUT and STDERR) to get real-time diagnostic information:az container attach --resource-group <your-resource-group> --name <your-container-name>
- The
- Diagnostic Settings:
- Ensure that diagnostic settings are configured to send logs to Azure Monitor logs. You can set this up in the Azure portal under the Monitoring section by selecting Diagnostic settings and configuring the destination for your logs.
- Log Analytics Workspace:
- If you're using a Log Analytics workspace, make sure it is correctly linked to your ACI. You can configure this in the Diagnostic settings by selecting Send to Log Analytics and choosing your workspace.
Reviewing Events:
Under the Events section in the Azure portal, you can see events related to your container instance. The error message "Container prowlarr-server terminated with ExitCode 100" indicates that the container exited with an error. Reviewing the logs can provide more details on why this happened.
For more information:
https://learn.microsoft.com/en-us/azure/container-instances/monitor-azure-container-instances
https://learn.microRequired fields are marked with asterisk/starDisplay text Address SaveRemovesoft.com/en-us/azure/container-instances/container-instances-get-logs
If you have any other questions or are still running into more issues, let me know in the "comments" and I would be happy to help you.
- View Logs in Azure Portal:
-
Keshavulu Dasari 2,835 Reputation points • Microsoft Vendor
2025-01-03T04:15:59.54+00:00 Hi Sergio Castañeda,
Just checking in to see if the response helped. If you have any questions, let me know in the "comments" and I would be happy to help you. -
Keshavulu Dasari 2,835 Reputation points • Microsoft Vendor
2025-01-06T16:04:00.6033333+00:00 Hi Sergio Castañeda,
Just checking in to see if the response helped. If you have any questions, let me know in the "comments" and I would be happy to help you. -
Sergio Castañeda 10 Reputation points • Microsoft Employee
2025-01-06T16:42:34.84+00:00 Hi @Keshavulu Dasari I’m still unable to figure out the reason for the ExitCode100.
-
Keshavulu Dasari 2,835 Reputation points • Microsoft Vendor
2025-01-06T17:54:50.8266667+00:00 ExitCode 100 typically indicates that the container's application encountered an error and exited. I suggest few steps to help you troubleshoot this issue:
Check Container Logs:
- Use the
az container logs
command to view the logs from your container. This can provide more details about why the application is failing.
Attach to the Container:
- Use the
az container attach
command to stream the container's STDOUT and STDERR to your local console. This can help you see real-time logs and understand what might be going wrong during the container's startup.
Review Diagnostic Events:
- In the Azure portal, navigate to your container instance and check the "Events" section for any diagnostic information. This can provide insights into what might be causing the issue.
Check Application Configuration:
- Ensure that the application configuration (e.g., environment variables, command-line arguments) is correct and matches what the application expects.
Image Compatibility & Resource Limits:
- Verify that the image you're using is compatible with Azure Container Instances. Sometimes, specific images might have dependencies or configurations that need to be addressed.
- Ensure that the container has sufficient resources (CPU, memory) allocated. Insufficient resources can cause the application to fail.
Double-check your network and storage configurations to ensure there are no issues with accessing necessary resources.
For more information:
https://learn.microsoft.com/en-us/azure/container-instances/container-state
https://learn.microsoft.com/en-us/azure/container-instances/container-instances-troubleshooting
If you are still facing issues, please provide some screenshots and details in the "comments" and I would be happy to help you.
- Use the
-
Keshavulu Dasari 2,835 Reputation points • Microsoft Vendor
2025-01-07T18:53:35.2533333+00:00 Hi Sergio Castañeda,
If you are still facing issues, please provide some screenshots and details in the "comments" and I would be happy to help you. -
Keshavulu Dasari 2,835 Reputation points • Microsoft Vendor
2025-01-08T14:26:54.7833333+00:00 Hi Sergio Castañeda,
Just checking in to see if the response helped. If you have any questions, let me know in the "comments" and I would be happy to help you.
Sign in to comment