你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

使用 PowerShell 将 Blob 数据集添加到 Azure 中的数据共享

该 PowerShell 脚本可以将 blob 数据集添加到现有 Data Share。

示例脚本

# Set variables with your own values
$resourceGroupName = "<Resource group name>"
$dataShareAccountName = "<Data share account name>"
$dataShareName = "<Data share name>"
$blobDatasetName = "<Dataset name>"
$blobContainer = "<Blob container name>"
$blobFilePath = "<Blob file path>"
$storageAccountResourceId = "<Storage account resource id>"

#Add a blob dataset to the datashare
New-AzDataShareDataSet -ResourceGroupName $resourceGroupName -AccountName $dataShareAccountName -ShareName $dataShareName -Name $blobDataSetName -StorageAccountResourceId $storageAccountResourceId -FilePath $blobFilePath

脚本说明

此脚本使用以下命令:

命令 备注
New-AzDataShareDataSet 将数据集添加到数据共享。

有关 Azure PowerShell 的详细信息,请参阅 Azure PowerShell 文档

可以在 Azure Data Share PowerShell 示例中找到其他 Azure Data Share PowerShell 脚本示例。