New-AzureStorageFileSASToken
Generates a shared access signature token for a Storage file.
Important
You've reached a webpage for an outdated version of Azure PowerShell. All versions of the AzureRM PowerShell module are outdated, but not out of support. The Az PowerShell module is now the recommended PowerShell module for interacting with Azure. To get started with the Az PowerShell module, see Install Azure PowerShell. To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.
Syntax
New-AzureStorageFileSASToken
[-ShareName] <String>
[-Path] <String>
[-Permission <String>]
[-Protocol <SharedAccessProtocol>]
[-IPAddressOrRange <String>]
[-StartTime <DateTime>]
[-ExpiryTime <DateTime>]
[-FullUri]
[-Context <IStorageContext>]
[<CommonParameters>]
New-AzureStorageFileSASToken
[-ShareName] <String>
[-Path] <String>
-Policy <String>
[-Protocol <SharedAccessProtocol>]
[-IPAddressOrRange <String>]
[-StartTime <DateTime>]
[-ExpiryTime <DateTime>]
[-FullUri]
[-Context <IStorageContext>]
[<CommonParameters>]
New-AzureStorageFileSASToken
-File <CloudFile>
[-Permission <String>]
[-Protocol <SharedAccessProtocol>]
[-IPAddressOrRange <String>]
[-StartTime <DateTime>]
[-ExpiryTime <DateTime>]
[-FullUri]
[<CommonParameters>]
New-AzureStorageFileSASToken
-File <CloudFile>
-Policy <String>
[-Protocol <SharedAccessProtocol>]
[-IPAddressOrRange <String>]
[-StartTime <DateTime>]
[-ExpiryTime <DateTime>]
[-FullUri]
[<CommonParameters>]
Description
The New-AzureStorageFileSASToken cmdlet generates a shared access signature token for an Azure Storage file.
Examples
Example 1: Generate a shared access signature token that has full file permissions
PS C:\> New-AzureStorageFileSASToken -ShareName "ContosoShare" -Path "FilePath" -Permission "rwd"
This command generates a shared access signature token that has full permissions for the file that is named FilePath.
Example 2: Generate a shared access signature token that has a time limit
PS C:\> $StartTime = Get-Date
PS C:\> $EndTime = $StartTime.AddHours(2.0)
PS C:\> New-AzureStorageFileSASToken -ShareName "ContosoShare" -Path "FilePath" -Permission "rwd" -StartTime $StartTime -ExpiryTime $EndTime
The first command creates a DateTime object by using the Get-Date cmdlet. The command stores the current time in the $StartTime variable.
The second command adds two hours to the object in $StartTime, and then stores the result in the $EndTime variable. This object is a time two hours in the future.
The third command generates a shared access signature token that has the specified permissions. This token becomes valid at the current time. The token remains valid until time stored in $EndTime.
Parameters
Specifies an Azure Storage context. To obtain a context, use the New-AzureStorageContext cmdlet.
Type: | IStorageContext |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
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 |
Specifies a CloudFile object. You can create a cloud file or obtain one by using the Get-AzureStorageFile cmdlet.
Type: | CloudFile |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
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 |
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 |
Specifies the path of the file relative to a Storage share.
Type: | String |
Position: | 1 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies the permissions for a Storage file.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the stored access policy for a file.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the protocol permitted for a request. The acceptable values for this parameter are:
- HttpsOnly
- HttpsOrHttp
The default value is HttpsOrHttp.
Type: | SharedAccessProtocol |
Accepted values: | HttpsOnly, HttpsOrHttp |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the name of the Storage share.
Type: | String |
Position: | 0 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
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 |
Inputs
IStorageContext
Parameter 'Context' accepts value of type 'IStorageContext' from the pipeline
CloudFile
Parameter 'File' accepts value of type 'CloudFile' from the pipeline
String
Parameter 'Path' accepts value of type 'String' from the pipeline
String
Parameter 'ShareName' accepts value of type 'String' from the pipeline