mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-26 12:33:59 +00:00
feat: add Azure storage account access key support to SDKs (#5177)
Add `azure_storage_account_access_key_secret` to the sync and async
Python storage integration APIs, with a matching Rust constructor. The
SDK sends a Secret reference in SQL and decodes the reference returned
by CREATE and DESCRIBE.
```python
info = db.create_storage_integration(
"blobs", "az://customer-data/raw/",
storage_provider="AZURE",
azure_storage_account="customeraccount",
azure_storage_account_access_key_secret="azure_key",
)
```
Azure requires a storage account and one authentication mode. The
account access key uses a single Secret. Service principal
authentication uses the existing three Secret references.
This commit is contained in:
@@ -1522,7 +1522,7 @@ integration = db.create_storage_integration(
|
||||
print(integration.configuration_instructions)
|
||||
```
|
||||
|
||||
Use `SecretReference` to qualify another database or namespace. Sync and async connections use the same options. Secret values are never part of integration metadata. Azure supports service principal client credentials; managed identity, account key and SAS authentication are not integration modes.
|
||||
Use `SecretReference` to qualify another database or namespace. Sync and async connections use the same options. Secret values are never part of integration metadata. Azure supports service principal credentials and storage account access keys.
|
||||
|
||||
The equivalent SQL is:
|
||||
|
||||
@@ -1539,6 +1539,23 @@ SHOW STORAGE INTEGRATIONS;
|
||||
DROP STORAGE INTEGRATION customer_blobs;
|
||||
```
|
||||
|
||||
For Shared Key authorization, store the storage account access key in one
|
||||
Secret and pass its reference as the only credential option:
|
||||
|
||||
```python
|
||||
integration = db.create_storage_integration(
|
||||
"customer_blobs_key",
|
||||
"az://customer-data/raw/",
|
||||
storage_provider="AZURE",
|
||||
azure_storage_account="customeraccount",
|
||||
azure_storage_account_access_key_secret="azure_key",
|
||||
)
|
||||
```
|
||||
|
||||
The equivalent SQL credential option is
|
||||
`STORAGE_AZURE_STORAGE_ACCOUNT_ACCESS_KEY_SECRET = public.azure_key`. Shared
|
||||
Key authorization must be enabled on the Azure storage account.
|
||||
|
||||
Registration returns setup instructions and leaves `access_verified` false. It stores an account-qualified prefix such as `az://customer-data@customeraccount.blob.core.windows.net/raw/`.
|
||||
|
||||
### GCP storage integrations
|
||||
|
||||
@@ -22,7 +22,7 @@ integration's prefix covers it.
|
||||
| --- | --- | --- |
|
||||
| AWS S3 | An IAM role to assume, or a static access key pair | A role needs one extra step outside LanceDB: [trust policy setup](#trust). |
|
||||
| Google Cloud Storage | A service account's JSON key | No role-based alternative. |
|
||||
| Azure Blob Storage | A service principal's tenant, client ID and client secret | All three required together. |
|
||||
| Azure Blob Storage | Three service principal Secrets or one storage account access key Secret | Both modes require the storage account name. |
|
||||
| HuggingFace | An access token | Always required to create an integration. For anonymous access at HuggingFace's default rate limits, register no integration for that prefix instead. |
|
||||
|
||||
Every credential option takes a [Secret](/management/secret) reference,
|
||||
@@ -99,6 +99,11 @@ role-based alternative.
|
||||
|
||||
### Azure Blob Storage {#azure}
|
||||
|
||||
Specify the storage account and choose either service principal credentials or
|
||||
a storage account access key. Reference the values through Secrets.
|
||||
|
||||
#### Service principal
|
||||
|
||||
<CodeGroup>
|
||||
```sql SQL icon="database"
|
||||
CREATE STORAGE INTEGRATION blobs
|
||||
@@ -121,8 +126,48 @@ db.create_storage_integration(
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
All four options are required together; there is no role-based
|
||||
alternative for Azure.
|
||||
#### Storage account access key
|
||||
|
||||
Store the key in a single Secret. Azure must allow Shared Key authorization on
|
||||
the storage account.
|
||||
|
||||
<CodeGroup>
|
||||
```sql SQL icon="database"
|
||||
CREATE STORAGE INTEGRATION blobs_key
|
||||
STORAGE_PROVIDER = 'AZURE'
|
||||
STORAGE_PREFIX = 'az://customer-data/raw/'
|
||||
STORAGE_AZURE_STORAGE_ACCOUNT = 'customeraccount'
|
||||
STORAGE_AZURE_STORAGE_ACCOUNT_ACCESS_KEY_SECRET = azure_key
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
Use SQL to create the integration from TypeScript applications.
|
||||
|
||||
{/*
|
||||
Draft for the SDK release with Azure storage account access key support.
|
||||
Publish these examples when the client APIs and Enterprise support ship.
|
||||
|
||||
<CodeGroup>
|
||||
```python Python icon="python"
|
||||
db.create_storage_integration(
|
||||
"blobs_key", "az://customer-data/raw/",
|
||||
storage_provider="AZURE",
|
||||
azure_storage_account="customeraccount",
|
||||
azure_storage_account_access_key_secret="azure_key",
|
||||
)
|
||||
```
|
||||
```rust
|
||||
use lancedb::storage_integration::{CreateStorageIntegrationRequest, SecretReference};
|
||||
|
||||
let request = CreateStorageIntegrationRequest::azure_with_account_access_key(
|
||||
"az://customer-data/raw/",
|
||||
"customeraccount",
|
||||
SecretReference::new("azure_key"),
|
||||
);
|
||||
let info = db.create_storage_integration("blobs_key", request, &[]).await?;
|
||||
```
|
||||
</CodeGroup>
|
||||
*/}
|
||||
|
||||
### HuggingFace {#huggingface}
|
||||
|
||||
|
||||
@@ -97,9 +97,12 @@ CREATE STORAGE INTEGRATION blobs
|
||||
| `STORAGE_AZURE_TENANT_ID_SECRET` | Secret ref | Entra ID tenant |
|
||||
| `STORAGE_AZURE_CLIENT_ID_SECRET` | Secret ref | service principal client ID |
|
||||
| `STORAGE_AZURE_CLIENT_SECRET_SECRET` | Secret ref | service principal client secret |
|
||||
| `STORAGE_AZURE_STORAGE_ACCOUNT_ACCESS_KEY_SECRET` | Secret ref | storage account access key for Azure Shared Key authorization |
|
||||
|
||||
All four are required together; there is no role-based alternative for
|
||||
Azure.
|
||||
Specify the storage account and choose one credential mode. Service principal
|
||||
authentication requires all three service principal Secret references. Shared
|
||||
Key authentication requires the account access key Secret reference and an Azure
|
||||
storage account that allows Shared Key authorization.
|
||||
|
||||
### GCP {#gcp}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user