You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何配置Azure Data Factory通过SAS令牌在复制活动中自动创建存储表

Azure Data Factory使用SAS令牌认证时无法自动创建目标Table存储表

我正在创建Azure Data Factory管道,将数据从Blob存储复制到Table存储。目标表可能不存在于Table存储中,需要在不存在时自动创建。我的Table存储链接服务必须使用SAS令牌进行身份验证,令牌值从Key Vault中获取。

目前链接服务配置和管道其他部分均正常工作,但当目标表不存在时,管道执行失败。我曾使用账户密钥身份验证完成过类似配置(该配置可自动创建表),但需要实现SAS令牌身份验证下的自动建表。

当前配置

Table存储账户链接服务配置

{
    "name": "Table Storage Account",
    "type": "Microsoft.DataFactory/factories/linkedservices",
    "properties": {
        "parameters": {
            "StorageAccountName": {
                "type": "string"
            },
            "TableName": {
                "type": "string"
            }
        },
        "annotations": [],
        "type": "AzureTableStorage",
        "typeProperties": {
            "sasUri": "https://@{linkedService().StorageAccountName}.table.core.windows.net/@{linkedService().TableName}",
            "sasToken": {
                "type": "AzureKeyVaultSecret",
                "store": {
                    "referenceName": "Key Vault",
                    "type": "LinkedServiceReference"
                },
                "secretName": {
                    "value": "@{linkedService().StorageAccountName}-sas",
                    "type": "Expression"
                }
            }
        }
    }
}

SAS令牌设置

sv=2021-12-02&ss=t&srt=sco&sp=rwlacu&se=2023-05-02T03:00:00Z&st=2023-04-19T16:09:39Z&spr=https&sig=[REDACTED]

复制数据活动数据集配置

{
    "name": "StorageTable",
    "properties": {
        "description": "Dataset for the azure table account.",
        "linkedServiceName": {
            "referenceName": "Table Storage Account",
            "type": "LinkedServiceReference",
            "parameters": {
                "StorageAccountName": {
                    "value": "@dataset().StorageAccountName",
                    "type": "Expression"
                },
                "TableName": {
                    "value": "@dataset().TableName",
                    "type": "Expression"
                }
            }
        },
        "parameters": {
            "StorageAccountName": {
                "type": "string"
            },
            "TableName": {
                "type": "string"
            }
        },
        "annotations": [],
        "type": "AzureTable",
        "schema": [],
        "typeProperties": {
            "tableName": {
                "value": "@dataset().TableName",
                "type": "Expression"
            }
        }
    },
    "type": "Microsoft.DataFactory/factories/datasets"
}

复制数据活动接收器配置

"sink": {
    "type": "AzureTableSink",
    "azureTableInsertType": "replace",
    "azureTablePartitionKeyName": {
        "value": "PartitionKey",
        "type": "Expression"
    },
    "azureTableRowKeyName": {
        "value": "RowKey",
        "type": "Expression"
    },
    "writeBatchSize": 10000
}

当前配置下,门户中所有连接验证均成功,但ADF不会自动创建不存在的表。

示例错误信息

ErrorCode=FailedStorageOperation,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A storage operation failed with the following error '0:The table specified does not exist.
RequestId:0c4fc844-d002-0001-0d87-738fd1000000
Time:2023-04-20T12:58:38.1032528Z'.,Source=,''Type=Microsoft.WindowsAzure.Storage.StorageException,Message=0:The table specified does not exist.
RequestId:0c4fc844-d002-0001-0d87-738fd1000000
Time:2023-04-20T12:58:38.1032528Z,Source=Microsoft.WindowsAzure.Storage,StorageExtendedMessage=0:The table specified does not exist.
RequestId:0c4fc844-d002-0001-0d87-738fd1000000
Time:2023-04-20T12:58:38.1032528Z,,'

其他尝试

更新SAS URI

将sasUri修改为https://@{linkedService().StorageAccountName}.table.core.windows.net(移除表名),期望通过账户基础URI让数据工厂根据操作自动选择REST路径。

此修改导致门户中的连接验证失败(测试时已忽略),但管道仍可正常运行(可能因为数据集仍指定了表名),但依旧无法创建不存在的表。


内容的提问来源于stack exchange,提问作者humbleice

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 11:57:11