AzCopy Fails to Copy/Sync Some Files Saying No PUT Permission: Troubleshooting Guide
Image by Wileen - hkhazo.biz.id

AzCopy Fails to Copy/Sync Some Files Saying No PUT Permission: Troubleshooting Guide

Posted on

If you’re reading this, chances are you’ve encountered one of the most frustrating errors in AzCopy: “no PUT permission” while trying to copy or sync files. This error can be perplexing, especially when you’re confident that you have the necessary permissions. Don’t worry, we’ve got your back! In this article, we’ll delve into the possible causes, troubleshooting steps, and solutions to get AzCopy working smoothly for you.

Understanding AzCopy and the PUT Permission

AzCopy is a powerful command-line tool designed to transfer data in and out of Azure Blob Storage, File Storage, and other cloud-based storage services. The PUT permission is a crucial aspect of Azure Blob Storage, allowing users to upload files and blobs to a container. When AzCopy fails to copy or sync files, citing “no PUT permission,” it’s essentially saying that it lacks the necessary authorization to perform the specified action.

Cause 1: Insufficient Permissions or Access Control List (ACL)

The most common reason for the “no PUT permission” error is lack of sufficient permissions or a misconfigured Access Control List (ACL). You might have read-only access or inherit permissions from the parent container, which are not enough for AzCopy to perform the copying or syncing operation.

To resolve this issue:

  1. Verify that you have the necessary permissions: Ensure that your Azure account has the required permissions, such as Storage Blob Data Contributor or Storage Blob Data Owner. You can check your permissions by navigating to the Azure portal, accessing your storage account, and clicking on “Access control (IAM)”.
  2. Check the ACL: Review the ACL of the container and the files within it. Make sure the ACL is set to allow write or modify permissions. You can use the Azure CLI or Azure Storage Explorer to check and modify the ACL.

Cause 2: Incorrect Container Permissions

Another possible reason is that the container permissions are set to read-only or inherit from the parent container. AzCopy requires write permissions to perform copying and syncing operations.

To resolve this issue:

  • Check the container permissions: Use the Azure CLI or Azure Storage Explorer to verify the container permissions. Make sure the permissions are set to write or modify.
  • Set the container permissions: Use the Azure CLI or Azure Storage Explorer to set the container permissions to write or modify. You can use the following Azure CLI command:
az storage container set-permission --name <container-name> --permissions w

Cause 3: Blob-Type Mismatch

In some cases, the issue might be due to a blob-type mismatch. AzCopy expects the blob type to be either BlockBlob or PageBlob, but if the blob type is set to AppendBlob, it can cause issues.

To resolve this issue:

  1. Check the blob type: Use the Azure CLI or Azure Storage Explorer to verify the blob type. Make sure it’s set to either BlockBlob or PageBlob.
  2. Convert the blob type: Use the Azure CLI or Azure Storage Explorer to convert the blob type to BlockBlob or PageBlob. You can use the following Azure CLI command:
az storage blob update --container-name <container-name> --name <blob-name> --type BlockBlob

Cause 4: Blob Upload Size Limitations

AzCopy has a default upload size limit of 200 MB for single-threaded uploads and 100 MB for multi-threaded uploads. If you’re trying to upload a larger file, it might cause the “no PUT permission” error.

To resolve this issue:

  • Split large files: Divide large files into smaller chunks, and use AzCopy’s multi-threaded upload feature to upload them.
  • Increase the upload size limit: Use the `–blob-upload-size` option with AzCopy to increase the upload size limit. For example:
azcopy copy <source> <destination> --blob-upload-size 500MB

Troubleshooting Steps

If you’ve checked all the possible causes and still encounter the “no PUT permission” error, follow these troubleshooting steps:

  1. Verify AzCopy installation: Ensure that AzCopy is installed correctly and running the latest version.
  2. Check Azure account credentials: Verify that your Azure account credentials are valid and not expired.
  3. Validate storage account key: Make sure the storage account key is correct and not rotated recently.
  4. Test with Azure Storage Explorer: Use Azure Storage Explorer to upload a file to the same container to isolate the issue.
  5. Check AzCopy logs: Analyze the AzCopy logs to identify any specific errors or warnings.

Solutions and Workarounds

If you’ve tried all the above steps and still encounter the “no PUT permission” error, consider the following solutions and workarounds:

Solution 1: Use the Azure CLI instead of AzCopy

The Azure CLI provides a more granular control over Azure Storage operations. You can use the `az storage blob upload` command to upload files to a container.

az storage blob upload --container-name <container-name> --name <blob-name> --file <local-file-path>

Solution 2: Use a third-party Azure Storage client library

Instead of using AzCopy, you can utilize a third-party Azure Storage client library, such as the Azure Storage .NET Client Library or the Azure Storage Python Client Library.

Language Azure Storage Client Library
.NET Azure.Storage.Blobs
Python azure-storage-blob

Solution 3: Contact Azure Support

If none of the above solutions work, it’s possible that there’s an issue with your Azure account or storage configuration. Reach out to Azure Support for further assistance.

Conclusion

AzCopy’s “no PUT permission” error can be frustrating, but it’s often a solvable issue. By following the steps outlined in this article, you should be able to identify and resolve the underlying cause of the error. Remember to check permissions, container permissions, blob types, and upload size limitations. If all else fails, consider using alternative solutions like the Azure CLI or third-party Azure Storage client libraries. Happy troubleshooting!

Frequently Asked Questions

Stuck with AzCopy and wondering why it’s playing hard to get with some files? Don’t worry, we’ve got you covered!

Why does AzCopy fail to copy some files, citing ‘no PUT permission’?

The most common culprit behind this error is incorrect permission settings. Check if the Azure AD app registration has the necessary Storage Blob Data Contributor role assigned. Also, ensure the SAS token used has the required permissions for reading and writing files. If you’re still stuck, review your Azure storage account’s access control settings!

Can I use AzCopy with Azure AD authentication to resolve the permission issue?

Absolutely! You can use AzCopy with Azure AD authentication to avoid permission headaches. Just make sure to register an Azure AD app, assign it the Storage Blob Data Contributor role, and then use the `–auth-mode` parameter with `LOGIN` in your AzCopy command. This will authenticate AzCopy using your Azure AD credentials, granting it the needed permissions to copy those pesky files!

What if I’m using a SAS token, but AzCopy still throws ‘no PUT permission’ errors?

SAS token troubles! First, verify that your SAS token hasn’t expired. Next, check the token’s permissions: does it have the `w` permission for writing files? If not, regenerate the SAS token with the required permissions. Additionally, ensure the SAS token is encoded correctly, as decoding issues can also cause permission errors. Lastly, try using a newer version of AzCopy to see if that resolves the issue!

Can I use the `–overwrite` option to force AzCopy to copy files despite permission issues?

Hold your horses! While the `–overwrite` option can be tempting, it won’t magically solve permission problems. In fact, using it with permission issues might even lead to file corruption or data loss! Instead, resolve the underlying permission issues as mentioned earlier. Once you’ve got the necessary permissions, AzCopy will copy files smoothly without any fuss!

What’s the best way to troubleshoot ‘no PUT permission’ errors in AzCopy?

When troubleshooting, it’s essential to gather more information about the error. Enable debug logging in AzCopy using the `–verbose` or `–debug` options. This will provide you with more detailed error messages, helping you pinpoint the root cause of the ‘no PUT permission’ issue. You can also try using Azure Storage Explorer to verify file-level permissions and access control settings!