New-​Azure​Storage​Share​SA​SToken

Generate Shared Access Signature token for Azure Storage share.

Syntax

New-AzureStorageShareSASToken
   [-ShareName] <String>
   [-Context <AzureStorageContext>]
   [-ExpiryTime <DateTime>]
   [-FullUri]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [-IPAddressOrRange <String>]
   [-Permission <String>]
   [-Protocol <SharedAccessProtocol>]
   [-StartTime <DateTime>]
   [<CommonParameters>]
New-AzureStorageShareSASToken
   [-ShareName] <String>
   [-Context <AzureStorageContext>]
   [-ExpiryTime <DateTime>]
   [-FullUri]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [-IPAddressOrRange <String>]
   -Policy <String>
   [-Protocol <SharedAccessProtocol>]
   [-StartTime <DateTime>]
   [<CommonParameters>]

Description

The New-AzureStorageShareSASToken cmdlet generates a shared access signature token for an Azure Storage share.

Examples

Example 1: Generate a shared access signature token for a share

PS C:\>New-AzureStorageShareSASToken -ShareName "ContosoShare" -Permission "rwdl"

This command creates a shared access signature token for the share named ContosoShare.

Example 2: Generate multiple shared access signature token by using the pipeline

PS C:\>Get-AzureStorageShare -Prefix "test" | New-AzureStorageShareSASToken -Permission "rwdl"

This command gets all the Storage shares that match the prefix test. The command passes them to the current cmdlet by using the pipeline operator. The current cmdlet creates a shared access token for each Storage share that has the specified permissions.

Example 3: Generate a shared access signature token that uses a shared access policy

PS C:\>New-AzureStorageShareSASToken -ShareName "ContosoShare" -Policy "ContosoPolicy03"

This command creates a shared access signature token for the Storage share named ContosoShare that has the policy named ContosoPolicy03.

Required Parameters

-Policy

Specifies the stored access policy for a share.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ShareName

Specifies the name of the Storage share.

Type:String
Aliases:N, Name
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False

Optional Parameters

-Context

Specifies an Azure Storage context. To obtain a context, use the New-AzureStorageContext cmdlet.

Type:AzureStorageContext
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False
-ExpiryTime

Specifies the time at which the shared access signature becomes invalid.

Type:DateTime
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-FullUri

Indicates that this cmdlet return the full blob URI and the shared access signature token.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-IPAddressOrRange

Specifies the IP address or range of IP addresses from which to accept requests, such as 168.1.5.65 or 168.1.5.60-168.1.5.70. The range is inclusive.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationAction

Specifies how this cmdlet responds to an information event.The acceptable values for this parameter are:- Continue

  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend
Type:ActionPreference
Aliases:infa
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationVariable

Specifies an information variable.

Type:String
Aliases:iv
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Permission

Specifies the permissions in the token to access the share and files under the share.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Protocol

Specifies the protocol permitted for a request. The acceptable values for this parameter are:

  • HttpsOnly
  • HttpsOrHttpThe default value is HttpsOrHttp.
Type:SharedAccessProtocol
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-StartTime

Specifies the time at which the shared access signature becomes valid.

Type:DateTime
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Notes

  • Keywords: common, azure, services, data, storage, blob, queue, table