< Back

Get-AADToken

Sat Jan 18, 2020 5:49 pm

NAME Get-AADToken



SYNOPSIS

Get token from Azure AD so you can use the other cmdlets.





SYNTAX

Get-AADToken [-TenantADName] <String> [-Credential] <PSCredential> [<CommonParameters>]



Get-AADToken [-OMSConnection] <Object> [<CommonParameters>]



Get-AADToken [-TenantID] <String> [-Credential] <PSCredential> [<CommonParameters>]





DESCRIPTION

Get token from Azure AD so you can use the other cmdlets.





PARAMETERS

-OMSConnection <Object>

Object that contains all needed parameters for working

with OMSSearch Module. You can create such object in

OMS Automation as connection asset.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TenantADName <String>

Valid Azure AD Tenant name.

Example: stanoutlook.onmicrosoft.com



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TenantID <String>

Valid Azure Tenant ID.

Example: eeb91fce-4be2-4a30-aad8-39e05fefde0



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Credential <PSCredential>

Valid user credentials to Azure AD. The Azure AD user must

have at least user rights in OMS and administrator and

Contributor rights on the Azure resource group where

the OMS workspace is located.



Required? true

Position? 2

Default value

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 (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

System.String. Returns token from Azure AD.





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>$token = Get-AADToken -TenantADName 'stanoutlook.onmicrosoft.com' -Credential $creds



Description

-----------

Grabs token from Azure AD by Tenant AD Name



Example Variables

-----------------

$creds = Get-Credetnial









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>$token = Get-AADToken -TenantID 'eeb91fce-4be2-4a30-aad8-39e05fefde0' -Credential $creds



Description

-----------

Grabs token from Azure AD by Tenant ID



Example Variables

-----------------

$creds = Get-Credetnial









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>$Token = Get-AADToken -OMSConnection $OMSCon



Description

-----------

Grabs token from Azure AD by using information from asset of type connection in OMS Automation



Example Variables

-----------------

$OMSCon = Get-AutomationConnection -Name 'stasoutlook'











RELATED LINKS