< Back

New-AzureStorageBlobSASToken

Tue Jan 29, 2019 9:27 pm

NAME New-AzureStorageBlobSASToken



SYNOPSIS

Generates a SAS token for an Azure storage blob.





SYNTAX

New-AzureStorageBlobSASToken [-Container] <String> [-Blob] <String> [-Context <IStorageContext>] [-ExpiryTime <DateTime>] [-FullUri]

[-IPAddressOrRange <String>] [-Permission <String>] [-Protocol {HttpsOnly | HttpsOrHttp}] [-StartTime <DateTime>] [<CommonParameters>]



New-AzureStorageBlobSASToken [-Container] <String> [-Blob] <String> [-Context <IStorageContext>] [-ExpiryTime <DateTime>] [-FullUri]

[-IPAddressOrRange <String>] -Policy <String> [-Protocol {HttpsOnly | HttpsOrHttp}] [-StartTime <DateTime>] [<CommonParameters>]



New-AzureStorageBlobSASToken -CloudBlob <CloudBlob> [-Context <IStorageContext>] [-ExpiryTime <DateTime>] [-FullUri] [-IPAddressOrRange <String>]

-Policy <String> [-Protocol {HttpsOnly | HttpsOrHttp}] [-StartTime <DateTime>] [<CommonParameters>]



New-AzureStorageBlobSASToken -CloudBlob <CloudBlob> [-Context <IStorageContext>] [-ExpiryTime <DateTime>] [-FullUri] [-IPAddressOrRange <String>]

[-Permission <String>] [-Protocol {HttpsOnly | HttpsOrHttp}] [-StartTime <DateTime>] [<CommonParameters>]





DESCRIPTION

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





PARAMETERS

-Blob <String>

Specifies the storage blob name.



Required? true

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-CloudBlob <CloudBlob>

Specifies the CloudBlob object. To obtain a CloudBlob object, use the Get-AzureStorageBlob (./Get-AzureStorageBlob.md)cmdlet.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Container <String>

Specifies the storage container name.



Required? true

Position? 0

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Context <IStorageContext>

Specifies the storage context.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? false



-ExpiryTime <DateTime>

Specifies when the shared access signature expires.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-FullUri [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-IPAddressOrRange <String>

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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Permission <String>

Specifies the permissions for a storage blob.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Policy <String>

Specifies an Azure Stored Access Policy.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Protocol <SharedAccessProtocol>

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



* HttpsOrHttp





The default value is HttpsOrHttp.





Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-StartTime <DateTime>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

IStorageContext

Parameter 'Context' accepts value of type 'IStorageContext' from the pipeline





OUTPUTS

System.String







NOTES









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.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... obsastoken

Get-AzureStorageBlob

New-AzureStorageContainerSASToken