azure-sdk-for-cpp/sdk/storage/TestingGuide.md
microzchang 06c0159137
Storage/Add instruction for setting up storage accounts (#4917)
* update readme.md

* update

* fxi spell

* update link

* update link

* update

---------

Co-authored-by: Jinming Hu <jinmhu@microsoft.com>
2023-09-05 14:01:49 +08:00

3.5 KiB

Setup Storage Resources for Running Unit Tests

Storage accounts are required for running storage unit tests. We don't expect users or developers to do these configurations or run unit tests, unless you're making some major changes or working on new features.

Azure Storage libraries for C++ offers three types for authorizing access to data: Shared Key(storage account key), Shared access signature (SAS) and Azure Active Directory (Azure AD). The first two types can be obtained by connection string.

Set up storage account

Before setting up storage account, you should have an overview of storage account: Storage account overview.

Set up steps:

  1. Create storage account
  2. Get storage account connection string
  3. Fill the connection strings in source code or environment variables.
Environment Variable Variable in Source Code Storage Account Details
STANDARD_STORAGE_CONNECTION_STRING StandardStorageConnectionStringValue Account Kind: General Purpose V2
Performance: Standard
Replication: RA-GRS
Enabled Features: soft delete for blobs, soft delete for containers, versioning for blobs
PREMIUM_FILE_CONNECTION_STRING PremiumStorageConnectionStringValue Account Kind: FileStorage
Performance: Premium
Replication: LRS
ADLS_GEN2_CONNECTION_STRING AdlsGen2ConnectionStringValue Account Kind: General Purpose V2
Performance: Standard
Replication: LRS
Enabled Features: hierarchical namespace

Set up Azure AD for storage account

Before setting it up, you should have an overview of accessing storage through Azure AD: Authorize access to blobs using Azure Active Directory.

Set up steps:

  1. Create Azure Service Principal.
  2. Assign an Azure role for access to blob data.
  3. Fill the tenant id, client id and client secret in environment variables or in source code.