51黑料不打烊

使用API将Azure Blob Storage连接到Experience Platform

阅读本指南,了解如何使用Azure Blobg StorageAPI帐户连接到51黑料不打烊 Experience Platform。

快速入门

本指南要求您对 51黑料不打烊 Experience Platform 的以下组件有一定了解:

  • : Experience Platform允许从各种源摄取数据,同时让您能够使用Experience Platform服务来构建、标记和增强传入数据。
  • 沙盒: Experience Platform提供了将单个Experience Platform实例划分为多个单独的虚拟环境的虚拟沙盒,以帮助开发和改进数字体验应用程序。

使用Experience Platform API

有关如何成功调用Experience Platform API的信息,请参阅Experience Platform API快速入门指南。

收集所需的凭据

有关身份验证的信息,请阅读Azure Blob Storage 概述

将您的Azure Blob Storage帐户连接到Experience Platform connect

有关如何将您的Azure Blob Storage帐户连接到Experience Platform的信息,请阅读以下步骤。

创建基本连接

NOTE
创建后,无法更改Azure Blob Storage基本连接的身份验证类型。 要更改身份验证类型,必须创建新的基本连接。

基本连接可将您的源链接到Experience Platform,以存储身份验证详细信息、连接状态和唯一ID。 使用此ID浏览源文件并标识要摄取的特定项目,包括其数据类型和格式。

您可以使用以下身份验证类型将您的Azure Blob Storage帐户连接到Experience Platform:

  • 帐户密钥身份验证:使用存储帐户的访问密钥进行身份验证并连接到您的Azure Blob Storage帐户。
  • 共享访问签名(厂础厂):使用SAS URI为您的Azure Blob Storage帐户中的资源提供委派的、有时间限制的访问。
  • 基于服务主体的身份验证:使用Azure Active Directory (AAD)服务主体(客户端ID和密码)对您的Azure Blob存储帐户进行安全身份验证。

础笔滨格式

POST /connections

要创建基本连接滨顿,请向/connections端点发出笔翱厂罢请求,并提供您的身份验证凭据作为请求参数的一部分。

帐户密钥身份验证

若要使用帐户密钥身份验证,请提供您的connectionStringcontainerfolderPath的值。

code language-shell
curl -X POST \
  'https://platform.adobe.io/data/foundation/flowservice/connections' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'x-api-key: {API_KEY}' \
  -H 'x-gw-ims-org-id: {ORG_ID}' \
  -H 'x-sandbox-name: {SANDBOX_NAME}' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Azure Blob Storage connection using connectingString",
    "description": "Azure Blob Storage connection using connectionString",
    "auth": {
      "specName": "ConnectionString",
      "params": {
        "connectionString": "DefaultEndpointsProtocol=https;AccountName={ACCOUNT_NAME};AccountKey={ACCOUNT_KEY}",
        "container": "acme-blob-container",
        "folderPath": "/acme/customers/salesData"
      }
    },
    "connectionSpec": {
      "id": "4c10e202-c428-4796-9208-5f1f5732b1cf",
      "version": "1.0"
    }
  }'
table 0-row-2 1-row-2 2-row-2 3-row-2 4-row-2
参数 描述
connectionString Azure Blob Storage帐户的连接字符串。 连接字符串模式为: DefaultEndpointsProtocol=https;AccountName={ACCOUNT_NAME};AccountKey={ACCOUNT_KEY};EndpointSuffix=core.windows.net
container 存储数据文件的Azure Blob Storage容器的名称。
folderPath 指定容器中文件所在的路径。
connectionSpec.id Azure Blob Storage源的连接规范ID。 此ID被固定为: 4c10e202-c428-4796-9208-5f1f5732b1cf
共享访问签名

要使用共享访问签名,请为您的sasUricontainerfolderPath提供值。

code language-shell
curl -X POST \
  'https://platform.adobe.io/data/foundation/flowservice/connections' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'x-api-key: {API_KEY}' \
  -H 'x-gw-ims-org-id: {ORG_ID}' \
  -H 'x-sandbox-name: {SANDBOX_NAME}' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Azure Blob Storage source connection using SAS URI",
    "description": "Azure Blob Storage source connection using SAS URI",
    "auth": {
      "specName": "SAS URI Authentication",
      "params": {
        "sasUri": "https://{ACCOUNT_NAME}.blob.core.windows.net/?sv={STORAGE_VERSION}&st={START_TIME}&se={EXPIRE_TIME}&sr={RESOURCE}&sp={PERMISSIONS}>&sip=<{IP_RANGE}>&spr={PROTOCOL}&sig={SIGNATURE}>",
        "container": "acme-blob-container",
        "folderPath": "/acme/customers/salesData"
      }
    },
    "connectionSpec": {
      "id": "4c10e202-c428-4796-9208-5f1f5732b1cf",
      "version": "1.0"
    }
  }'
table 0-row-2 1-row-2 2-row-2 3-row-2 4-row-2
参数 描述
sasUri 共享访问签名URI,您可以将其用作连接帐户的替代身份验证类型。 SAS URI模式为: https://{ACCOUNT_NAME}.blob.core.windows.net/?sv={STORAGE_VERSION}&st={START_TIME}&se={EXPIRE_TIME}&sr={RESOURCE}&sp={PERMISSIONS}>&sip=<{IP_RANGE}>&spr={PROTOCOL}&sig={SIGNATURE}
container 存储数据文件的Azure Blob Storage容器的名称。
folderPath 指定容器中文件所在的路径。
connectionSpec.id Azure Blob Storage源的连接规范ID。 此ID被固定为: 4c10e202-c428-4796-9208-5f1f5732b1cf
基于服务主体的身份验证

要通过基于服务主体的身份验证进行连接,请提供以下各项的值: serviceEndpointservicePrincipalIdservicePrincipalKeyaccountKindtenantcontainerfolderPath

code language-shell
curl -X POST \
  'https://platform.adobe.io/data/foundation/flowservice/connections' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'x-api-key: {API_KEY}' \
  -H 'x-gw-ims-org-id: {ORG_ID}' \
  -H 'x-sandbox-name: {SANDBOX_NAME}' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Azure Blob Storage source connection using service principal based authentication",
    "description": "Azure Blob Storage source connection using service principal based authentication",
    "auth": {
      "specName": "Service Principal Based Authentication",
      "params": {
        "serviceEndpoint": "{SERVICE_ENDPOINT}",
        "servicePrincipalId": "{SERVICE_PRINCIPAL_ID}",
        "servicePrincipalKey": "{SERVICE_PRINCIPAL_KEY}",
        "accountKind": "{ACCOUNT_KIND}",
        "tenant": "{TENANT}",
        "container": "acme-blob-container",
        "folderPath": "/acme/customers/salesData"
      }
    },
    "connectionSpec": {
      "id": "4c10e202-c428-4796-9208-5f1f5732b1cf",
      "version": "1.0"
    }
  }'
table 0-row-2 1-row-2 2-row-2 3-row-2 4-row-2 5-row-2 6-row-2 7-row-2 8-row-2
参数 描述
serviceEndpoint Azure Blob Storage帐户的终结点URL。 通常采用以下格式: https://{ACCOUNT_NAME}.blob.core.windows.net
servicePrincipalId 用于身份验证的Azure Active Directory (AAD)服务主体的客户端/应用程序ID。
servicePrincipalKey 与础锄耻谤别服务主体关联的客户端密钥或密码。
accountKind Azure Blob Storage帐户的类型。 通用值包括Storage (通用痴1)、StorageV2 (通用痴2)、BlobStorageBlockBlobStorage
tenant 注册服务主体的Azure Active Directory (AAD)租户ID。
container 存储数据文件的Azure Blob Storage容器的名称。
folderPath 指定容器中文件所在的路径。
connectionSpec.id Azure Blob Storage源的连接规范ID。 此ID被固定为: 4c10e202-c428-4796-9208-5f1f5732b1cf

成功的响应返回新创建的基本连接的详细信息,包括其唯一标识符(id)。 在下一步创建源连接时需要此ID。

{
    "id": "4cb0c374-d3bb-4557-b139-5712880adc55",
    "etag": "\"1700c57b-0000-0200-0000-5e3b3f440000\""
}

后续步骤

按照本教程,您已使用API创建了Blob连接,并获取了唯一ID作为响应正文的一部分。 您可以使用此连接ID以使用流服务API浏览云存储。

recommendation-more-help
337b99bb-92fb-42ae-b6b7-c7042161d089