Connecting CBCloudDrive to Azure Files


Requirements: CBFSCloud

This article explains how to configure CBCloudDrive to connect to Azure Files. For a general overview of how the component works, see Getting Started with the CBCloudDrive Component.

Getting Started

First go ahead and set the ConnectionType property to ctAzureFile and set CacheDirectory to a valid, writable local directory path. After that, you can build a connection string using the below parameters.

Connection Parameters

Parameter Description
RemoteRoot The path within Azure Files to use as the root of the mounted drive. The first segment must be the share name (e.g., /my-share). Additional segments specify a subfolder within the share (e.g., /my-share/my-folder).
Account The name of the Azure storage account. Required when not using OAuth authentication.
AccessKey The access key for the Azure storage account. Required when not using OAuth authentication.
OAuthClientId The client ID assigned when registering the application in the Azure portal. Required when using OAuth authentication.
OAuthClientSecret The client secret assigned when registering the application. Required when using OAuth authentication.

Authentication

To authenticate with a storage account access key, set Account to the storage account name and AccessKey to the key from the Azure portal.

drive.ConnectionType = CBCloudDriveConnectionTypes.ctAzureFile; drive.ConnectionString = "RemoteRoot=/my-share;Account=myaccount;AccessKey=MYACCESSKEY;";

OAuth (Microsoft Entra ID)

To authenticate via Microsoft Entra ID, register an application in the Azure portal and grant it the Storage File Data SMB Share Contributor role on the storage account. Set OAuthClientId and OAuthClientSecret to the application credentials. The authorization scope defaults to offline_access https://storage.azure.com/user_impersonation.

On the first run, leave OAuthRefreshToken unset. The component will open a browser window for the user to authorize the application. After authorization completes, a refresh token is stored in the OAuthRefreshToken connection string parameter automatically. Save this value and include it in the connection string for all subsequent runs to avoid re-prompting the user.

drive.ConnectionType = CBCloudDriveConnectionTypes.ctAzureFile; drive.ConnectionString = "RemoteRoot=/my-share;" + "OAuthClientId=MY-CLIENT-ID;OAuthClientSecret=MY-SECRET;";

We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@callback.com.