"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
azurefiles: add --azurefiles-use-az and --azurefiles-disable-instance-discovery
b-wimmer83cf8fb821dd
diff --git a/backend/azurefiles/azurefiles.go b/backend/azurefiles/azurefiles.goindex 7d9a53075..6deaebead 100644--- a/backend/azurefiles/azurefiles.go+++ b/backend/azurefiles/azurefiles.go@@ -237,6 +237,30 @@ msi_client_id, or msi_mi_res_id parameters.`,Help: "Azure resource ID of the user-assigned MSI to use, if any.\n\nLeave blank if msi_client_id or msi_object_id specified.",Advanced: true,Sensitive: true,+ }, {+ Name: "disable_instance_discovery",+ Help: `Skip requesting Microsoft Entra instance metadata+This should be set true only by applications authenticating in+disconnected clouds, or private clouds such as Azure Stack.+It determines whether rclone requests Microsoft Entra instance+metadata from ` + "`https://login.microsoft.com/`" + ` before+authenticating.+Setting this to true will skip this request, making you responsible+for ensuring the configured authority is valid and trustworthy.+`,+ Default: false,+ Advanced: true,+ }, {+ Name: "use_az",+ Help: `Use Azure CLI tool az for authentication+Set to use the [Azure CLI tool az](https://learn.microsoft.com/en-us/cli/azure/)+as the sole means of authentication.+Setting this can be useful if you wish to use the az CLI on a host with+a System Managed Identity that you do not want to use.+Don't set env_auth at the same time.+`,+ Default: false,+ Advanced: true,}, {Name: "endpoint",Help: "Endpoint for the service.\n\nLeave blank normally.",@@ -319,10 +343,12 @@ type Options struct {Username string `config:"username"`Password string `config:"password"`ServicePrincipalFile string `config:"service_principal_file"`+ DisableInstanceDiscovery bool `config:"disable_instance_discovery"`UseMSI bool `config:"use_msi"`MSIObjectID string `config:"msi_object_id"`MSIClientID string `config:"msi_client_id"`MSIResourceID string `config:"msi_mi_res_id"`+ UseAZ bool `config:"use_az"`Endpoint string `config:"endpoint"`ChunkSize fs.SizeSuffix `config:"chunk_size"`MaxStreamSize fs.SizeSuffix `config:"max_stream_size"`@@ -414,7 +440,8 @@ func newFsFromOptions(ctx context.Context, name, root string, opt *Options) (fs.}// Read credentials from the environmentoptions := azidentity.DefaultAzureCredentialOptions{- ClientOptions: policyClientOptions,+ ClientOptions: policyClientOptions,+ DisableInstanceDiscovery: opt.DisableInstanceDiscovery,}cred, err = azidentity.NewDefaultAzureCredential(&options)if err != nil {@@ -425,6 +452,13 @@ func newFsFromOptions(ctx context.Context, name, root string, opt *Options) (fs.if err != nil {return nil, fmt.Errorf("create new shared key credential failed: %w", err)}+ case opt.UseAZ:+ var options = azidentity.AzureCLICredentialOptions{}+ cred, err = azidentity.NewAzureCLICredential(&options)+ fmt.Println(cred)+ if err != nil {+ return nil, fmt.Errorf("failed to create Azure CLI credentials: %w", err)+ }case opt.SASURL != "":client, err = service.NewClientWithNoCredential(opt.SASURL, &clientOpt)if err != nil {diff --git a/docs/content/azurefiles.md b/docs/content/azurefiles.mdindex 532bd9f68..54bb1bd3a 100644--- a/docs/content/azurefiles.md+++ b/docs/content/azurefiles.md@@ -206,6 +206,13 @@ If the resource has multiple user-assigned identities you will need tounset `env_auth` and set `use_msi` instead. See the [`use_msi`section](#use_msi).+If you are operating in disconnected clouds, or private clouds such as+Azure Stack you may want to set `disable_instance_discovery = true`.+This determines whether rclone requests Microsoft Entra instance+metadata from `https://login.microsoft.com/` before authenticating.+Setting this to `true` will skip this request, making you responsible+for ensuring the configured authority is valid and trustworthy.+##### Env Auth: 3. Azure CLI credentials (as used by the az tool)Credentials created with the `az` tool can be picked up using `env_auth`.@@ -288,6 +295,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`.++#### Azure CLI tool `az` {#use_az}+Set to use the [Azure CLI tool `az`](https://learn.microsoft.com/en-us/cli/azure/)+as the sole means of authentication.+Setting this can be useful if you wish to use the `az` CLI on a host with+a System Managed Identity that you do not want to use.+Don't set `env_auth` at the same time.{{< rem autogenerated options start" - DO NOT EDIT - instead edit fs.RegInfo in backend/azurefiles/azurefiles.go then run make backenddocs" >}}### Standard options