New-​Azure​Storage​Container​SA​SToken

Generates an SAS token for an Azure storage container.

Syntax

New-AzureStorageContainerSASToken
   [-Name] <String>
   [-Context <IStorageContext>]
   [-ExpiryTime <DateTime>]
   [-FullUri]
   [-IPAddressOrRange <String>]
   [-Permission <String>]
   [-Protocol <SharedAccessProtocol>]
   [-StartTime <DateTime>]
   [<CommonParameters>]
New-AzureStorageContainerSASToken
   [-Name] <String>
   [-Context <IStorageContext>]
   [-ExpiryTime <DateTime>]
   [-FullUri]
   [-IPAddressOrRange <String>]
   -Policy <String>
   [-Protocol <SharedAccessProtocol>]
   [-StartTime <DateTime>]
   [<CommonParameters>]

Description

The New-AzureStorageContainerSASToken cmdlet generates a Shared Access Signature (SAS) token for an Azure storage container.

Examples

Example 1: Generate a container SAS token with full container permission

PS C:\>New-AzureStorageContainerSASToken -Name "Test" -Permission rwdl

This example generates a container SAS token with full container permission.

Example 2: Generate multiple container SAS token by pipeline

PS C:\>Get-AzureStorageContainer -Container test* | New-AzureStorageContainerSASToken -Permission rwdl

This example generates multiple container SAS tokens by using the pipeline.

Example 3: Generate container SAS token with shared access policy

PS C:\>New-AzureStorageContainerSASToken -Name "Test" -Policy "PolicyName"

This example generates a container SAS token with shared access policy.

Required Parameters

-Name

Specifies an Azure storage container name.

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

Specifies an Azure Stored Access Policy.

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

Optional Parameters

-Context

Specifies an Azure storage context. You can create it by using the New-AzureStorageContext cmdlet.

Type:IStorageContext
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.

If the user sets the start time but not the expiry time, the expiry time is set to the start time plus one hour. If neither the start time nor the expiry time is specified, the expiry time is set to the current time plus one hour.

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
-Permission

Specifies permissions for a storage container.

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
  • HttpsOrHttp

The default value is HttpsOrHttp.

Type:SharedAccessProtocol
Parameter Sets:HttpsOnly, HttpsOrHttp
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