< Back

New-AzureStorageShareSASToken

Tue Jan 29, 2019 9:27 pm

NAME New-AzureStorageShareSASToken



SYNOPSIS

Generate Shared Access Signature token for Azure Storage share.





SYNTAX

New-AzureStorageShareSASToken [-ShareName] <String> [-Context <IStorageContext>] [-ExpiryTime <DateTime>] [-FullUri] [-IPAddressOrRange <String>]

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



New-AzureStorageShareSASToken [-ShareName] <String> [-Context <IStorageContext>] [-ExpiryTime <DateTime>] [-FullUri] [-IPAddressOrRange <String>]

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





DESCRIPTION

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





PARAMETERS

-Context <IStorageContext>

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



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? false



-ExpiryTime <DateTime>

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



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 in the token to access the share and files under the share.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Policy <String>

Specifies the stored access policy for a share.



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



-ShareName <String>

Specifies the name of the Storage share.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

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



String

Parameter 'ShareName' accepts value of type 'String' from the pipeline





OUTPUTS

System.String







NOTES





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



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.







RELATED LINKS

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

Get-AzureStorageShareStoredAccessPolicy

New-AzureStorageFileSASToken