"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
azureblob: allow anonymous access for public resources
Nick Craig-Wood4824837eedcf
diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.goindex 6c07a3320..662be58a7 100644--- a/backend/azureblob/azureblob.go+++ b/backend/azureblob/azureblob.go@@ -711,10 +711,11 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, eClientOptions: policyClientOptions,}- // Here we auth by setting one of cred, sharedKeyCred or f.svc+ // Here we auth by setting one of cred, sharedKeyCred, f.svc or anonymousvar (cred azcore.TokenCredentialsharedKeyCred *service.SharedKeyCredential+ anonymous = false)switch {case opt.EnvAuth:@@ -874,6 +875,9 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, eif err != nil {return nil, fmt.Errorf("failed to acquire MSI token: %w", err)}+ case opt.Account != "":+ // Anonymous access+ anonymous = truedefault:return nil, errors.New("no authentication method configured")}@@ -903,6 +907,12 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, eif err != nil {return nil, fmt.Errorf("create client failed: %w", err)}+ } else if anonymous {+ // Anonymous public access+ f.svc, err = service.NewClientWithNoCredential(opt.Endpoint, &clientOpt)+ if err != nil {+ return nil, fmt.Errorf("create public client failed: %w", err)+ }}}if f.svc == nil {diff --git a/docs/content/azureblob.md b/docs/content/azureblob.mdindex 987045cb2..58c3f1f05 100644--- a/docs/content/azureblob.md+++ b/docs/content/azureblob.md@@ -289,6 +289,13 @@ be explicitly specified using exactly one of the `msi_object_id`,If none of `msi_object_id`, `msi_client_id`, or `msi_mi_res_id` isset, this is is equivalent to using `env_auth`.+#### Anonymous {#anonymous}++If you want to access resources with public anonymous access then set+`account` only. You can do this without making an rclone config:++ rclone lsf :azureblob,account=ACCOUNT:CONTAINER+{{< rem autogenerated options start" - DO NOT EDIT - instead edit fs.RegInfo in backend/azureblob/azureblob.go then run make backenddocs" >}}### Standard options