Get-DataGatewayAccessToken
Gets the access token for your current Data Gateway authenticated session.
Syntax
Default (Default)
Get-DataGatewayAccessToken
[-AsString]
[<CommonParameters>]
Description
Returns the Data Gateway access token gathered from logged in Data Gateway profile.
Before you run this command, make sure you log in using Connect-DataGatewayServiceAccount.
Examples
Example 1
PS C:\> $headers = Get-DataGatewayAccessToken
PS C:\> Invoke-RestMethod -Headers $headers -Uri 'https://api.powerbi.com/v1.0/myorg/groups'
Gets the Power BI access token as a hash table and passes it to Invoke-RestMethod, as part of the header, to authenticate.
Parameters
-AsString
Indicates to return the access token as a string instead of a hash table. The string contains the authentication type, such as Bearer.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.