Skip to content

util accesstoken get

Gets access token for the specified resource


util accesstoken get [options]


accesstoken get


Option Description
--help output usage information
-r, --resource <resource> The resource for which to retrieve an access token
--new Retrieve a new access token to ensure that it's valid for as long as possible
--query [query] JMESPath query string. See for more information and examples
-o, --output [output] Output type. json,text. Default text
--pretty Prettifies json output
--verbose Runs command with verbose logging
--debug Runs command with debug logging



The 'accesstoken get' command is deprecated. Please use 'util accesstoken get' instead.

The util accesstoken get command returns an access token for the specified resource. If an access token has been previously retrieved and is still valid, the command will return the cached token. If you want to ensure that the returned access token is valid for as long as possible, you can force the command to retrieve a new access token by using the --new option.


Get access token for the Microsoft Graph

util accesstoken get --resource

Get a new access token for SharePoint Online

util accesstoken get --resource --new