Connecting to Azure Blob Storage
Before You Connect
To obtain the credentials for an AzureBlob user, follow the steps below:
- Sign into the Azure portal with the credentials for your root account.
- Click on Storage Accounts and select the storage account you want to use.
- Under Settings, click Access keys.
- Your storage account name and key will be displayed on that page.
Connecting to Azure Blob Storage
Set AzureStorageAccount to your Azure Blob Storage account name.
Authenticating to Azure Blob Storage
You can authenticate to Azure Blob Storage via Access Key, Shared Access Signatures (SAS), AzureAD user, Azure MSI, or Azure Service Principal.
Access Key
Set the following to authenticate with an Azure Access Key:
- AuthScheme: Set this to AccessKey.
- AzureAccessKey: Set this to the storage key associated with your Azure Blob Storage account.
Shared Access Signature (SAS)
Set the following to authenticate with an Shared Access Signature (SAS):- AuthScheme: Set this to AzureStorageSAS.
- AzureSharedAccessSignature: Set this to the SAS associated with your Azure Blob Storage account.
- Sign into the Azure Portal with the credentials for your root account. (https://portal.azure.com/)
- Click storage accounts and select the storage account you want to use.
- Under settings, click Shared Access Signature.
- Set the permissions.
- Specify when you want the token to expire.
- Click Generate SAS and copy the shared access signature it generates.
- Set AzureSharedAccessSignature to the shared access signature from the previous step.
AzureAD User
AuthScheme must be set to AzureAD in all user account flows.
Desktop Applications
CData provides an embedded OAuth application that simplifies OAuth desktop Authentication. Alternatively, you can create a custom OAuth application. See Creating a Custom OAuth Application for information about creating custom applications and reasons for doing so.Get and Refresh the OAuth Access Token
After setting the following, you are ready to connect:
- OAuthClientId (custom applications only): Set this to the client Id assigned when you registered your app.
- OAuthClientSecret (custom applications only): Set this to the client secret assigned when you registered your app.
- CallbackURL (custom application only): Set this to the redirect URI defined when you registered your app. For example: http://localhost:33333
Azure Service Principal
Authentication as an Azure Service Principal is handled via the OAuth Client Credentials flow. It does not involve direct user authentication. Instead, credentials are created for just the application itself.All tasks taken by the application are done without a default user context, but based on the assigned roles. The application access to the resources is controlled through the assigned roles' permissions.
For Azure Service Principal authentication, set AuthScheme to AzureServicePrincipal.
Creating an AzureAD App and an Azure Service Principal
If you will authenticate using an Azure Service Principal, you must first create and register an Azure AD application with an Azure AD tenant, as described in Creating an Entra ID (Azure AD) Application.
In the Azure portal, navigate to App registrations > API permissions. Select the Microsoft Graph permissions. There are two distinct sets of permissions: Delegated permissions and Application permissions. The permissions used during client credential authentication are under Application Permissions.
Assigning a role to the application
To access resources in your subscription, you must assign an appropriate role to the custom Azure AD application. Do the following:
- Use the search bar to locate the Subscriptions service.
- Open the Subscriptions page.
- Select the subscription to which to assign the application.
- Open Access control (IAM) and select Add > Add role assignment. The Add role assignment page opens.
- Assign your custom Azure AD application the Owner role.
Setting the connection properties
The connection properties you set to connect with your custom Azure AD application will vary, depending on whether you want to authenticate using a Client Secret or a Certificate.
After you connect, authentication with client credentials takes place automatically like any other connection, except that no window opens to prompt the user. Because there is no user context, there is no need for a browser popup. Connections take place and are handled internally.
Client Secret Connection Properties
- AuthScheme: AzureServicePrincipal.
- InitiateOAuth: GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken.
- AzureTenant: The tenant to which you want to connect.
- OAuthClientId: The client Id in your custom Azure AD application settings.
- OAuthClientSecret: The client secret in your custom Azure AD application settings.
Certificate Connection Properties
- AuthScheme: AzureServicePrincipalCert.
- InitiateOAuth: GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken.
- AzureTenant: The tenant to which you want to connect.
- OAuthJWTCert: The JWT Certificate store.
- OAuthJWTCertType: The type of the certificate store specified by OAuthJWTCert.
- OAuthJWTIssuer: The issuer of the Java Web Token.
Note: In most cases, OAuthJWTIssuer takes the value of the OAuthClientId property and does not need to be individually set.
Azure MSI
If you are connecting from an Azure VM with permissions for Azure Data Lake Storage, set AuthScheme to AzureMSI.