Edit

Share via


Use PowerShell to create a data share in Azure

This PowerShell script adds a blob dataset to an existing Data Share.

Sample script

# 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

Script explanation

This script uses the following commands:

Command Notes
New-AzDataShareDataSet Adds a dataset to a data share.

For more information on the Azure PowerShell, see Azure PowerShell documentation.

Other Azure Data Share PowerShell script samples can be found in the Azure Data Share PowerShell samples.