New-​Azure​Storage​Blob​SA​SToken

Generates an SAS token for an Azure storage blob.

Syntax

New-AzureStorageBlobSASToken
   [-Container] <String>
   [-Blob] <String>
   [-Context <AzureStorageContext>]
   [-ExpiryTime <DateTime>]
   [-FullUri]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [-IPAddressOrRange <String>]
   [-Permission <String>]
   [-PipelineVariable <String>]
   [-Protocol <SharedAccessProtocol>]
   [-StartTime <DateTime>]
   [<CommonParameters>]
New-AzureStorageBlobSASToken
   [-Container] <String>
   [-Blob] <String>
   [-Context <AzureStorageContext>]
   [-ExpiryTime <DateTime>]
   [-FullUri]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [-IPAddressOrRange <String>]
   [-PipelineVariable <String>]
   -Policy <String>
   [-Protocol <SharedAccessProtocol>]
   [-StartTime <DateTime>]
   [<CommonParameters>]
New-AzureStorageBlobSASToken
   -CloudBlob <CloudBlob>
   [-Context <AzureStorageContext>]
   [-ExpiryTime <DateTime>]
   [-FullUri]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [-IPAddressOrRange <String>]
   [-PipelineVariable <String>]
   -Policy <String>
   [-Protocol <SharedAccessProtocol>]
   [-StartTime <DateTime>]
   [<CommonParameters>]
New-AzureStorageBlobSASToken
   -CloudBlob <CloudBlob>
   [-Context <AzureStorageContext>]
   [-ExpiryTime <DateTime>]
   [-FullUri]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [-IPAddressOrRange <String>]
   [-Permission <String>]
   [-PipelineVariable <String>]
   [-Protocol <SharedAccessProtocol>]
   [-StartTime <DateTime>]
   [<CommonParameters>]

Description

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

Examples

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

PS C:\>New-AzureStorageBlobSASToken -Container "ContainerName" -Blob "BlobName" -Permission rwd

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

Example 2: Generate a blob SAS token with life time

PS C:\> $StartTime = Get-Date
PS C:\> $EndTime = $startTime.AddHours(2.0)
PS C:\> New-AzureStorageBlobSASToken -Container "ContainerName" -Blob "BlobName" -Permission rwd -StartTime $StartTime -ExpiryTime $EndTime

This example generates a blob SAS token with life time.

Required Parameters

-Blob

Specifies the storage blob name.

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-CloudBlob

Specifies the CloudBlob object. To obtain a CloudBlob object, use the Get-AzureStorageBlob cmdlet.

Type:CloudBlob
Aliases:ICloudBlob
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Container

Specifies the storage container name.

Type:String
Position:0
Default value:None
Accept pipeline input:False
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 the storage context.

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

Specifies when the shared access signature expires.

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 for a storage blob.

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

Stores the value of the current pipeline element as a variable, for any named command as it flows through the pipeline.

Type:String
Aliases:pv
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