Edit

Use PowerShell to accept a data share invitation

Important

Azure Data Share is being retired. You can no longer create new Azure Data Share accounts, and existing capabilities will remain in maintenance mode through November 12, 2029. For retirement timelines, transition guidance, and recommended next steps, see the Azure Data Share retirement announcement.

This PowerShell script accepts invitations sent to a consumer.

Sample script

#List invitations sent to a consumer
Get-AzDataShareInvitation

# Set variables with your own values
$resourceGroupName = "<Resource group name>"
$dataShareAccountName = "<Data share account name>"
$dataShareName = "<Data share name>"
$invitationId = "<Invitation id>"

#Accept a specific invitation by creating a share subscription
New-AzDataShareSubscription -ResourceGroupName $resourceGroupName -AccountName $dataShareAccountName -Name $dataShareName -InvitationId $invitationId

Script explanation

This script uses the following commands:

Command Notes
Get-AzDataShareInvitation Get and list sent data share invitations.
New-AzDataShareSubscription Create a data share subscription.

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.