< Back

Get-MsalClientApplication

Sat Jan 18, 2020 4:37 pm

NAME Get-MsalClientApplication



SYNOPSIS

Get client application from local session cache.





SYNTAX

Get-MsalClientApplication -ClientId <String> [-RedirectUri <Uri>] [-TenantId <String>] [-Authority <Uri>]

[-CreateIfMissing] [<CommonParameters>]



Get-MsalClientApplication [-ClientId <String>] [-ClientSecret <SecureString>] [-ClientCertificate

<X509Certificate2>] [-RedirectUri <Uri>] [-TenantId <String>] [-Authority <Uri>] [-ConfidentialClientOptions]

<ConfidentialClientApplicationOptions> [-CreateIfMissing] [<CommonParameters>]



Get-MsalClientApplication -ClientId <String> -ClientCertificate <X509Certificate2> [-RedirectUri <Uri>] [-TenantId

<String>] [-Authority <Uri>] [-CreateIfMissing] [<CommonParameters>]



Get-MsalClientApplication -ClientId <String> -ClientSecret <SecureString> [-RedirectUri <Uri>] [-TenantId

<String>] [-Authority <Uri>] [-CreateIfMissing] [<CommonParameters>]



Get-MsalClientApplication [-ClientId <String>] [-RedirectUri <Uri>] [-TenantId <String>] [-Authority <Uri>]

[-PublicClientOptions] <PublicClientApplicationOptions> [-CreateIfMissing] [<CommonParameters>]





DESCRIPTION

This cmdlet will return a client application object from the local session cache. If it does not yet exist, a new

client application will be created and added to the cache.





PARAMETERS

-ClientId <String>

Identifier of the client requesting the token.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ClientSecret <SecureString>

Secure secret of the client requesting the token.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ClientCertificate <X509Certificate2>

Client assertion certificate of the client requesting the token.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-RedirectUri <Uri>

Address to return to upon receiving a response from the authority.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TenantId <String>

Tenant identifier of the authority to issue token.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Authority <Uri>

Address of the authority to issue token.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-PublicClientOptions <PublicClientApplicationOptions>

Public client application options



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-ConfidentialClientOptions <ConfidentialClientApplicationOptions>

Confidential client application options



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-CreateIfMissing [<SwitchParameter>]

Create application in cache if it does not already exist



Required? false

Position? named

Default value False

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

Microsoft.Identity.Client.PublicClientApplication



Microsoft.Identity.Client.ConfidentialClientApplication





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



PS C:\\>Get-MsalClientApplication -ClientId '00000000-0000-0000-0000-000000000000'



Get public client application using default settings.









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



PS C:\\>$ConfidentialClientOptions = New-Object Microsoft.Identity.Client.ConfidentialClientApplicationOptions

-Properties @{ ClientId = '00000000-0000-0000-0000-000000000000' }



PS C:\\>$ConfidentialClientOptions | Get-MsalClientApplication -ClientSecret (ConvertTo-SecureString

'SuperSecretString' -AsPlainText -Force) -TenantId '00000000-0000-0000-0000-000000000000'

Pipe in confidential client options object to get a confidential client application using a client secret and

target a specific tenant.









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



PS C:\\>$ClientCertificate = Get-Item Cert:\\CurrentUser\\My\\0000000000000000000000000000000000000000



PS C:\\>$ConfidentialClientOptions = New-Object Microsoft.Identity.Client.ConfidentialClientApplicationOptions

-Properties @{ ClientId = '00000000-0000-0000-0000-000000000000'; TenantId =

'00000000-0000-0000-0000-000000000000' }

PS C:\\>$ConfidentialClientOptions | Get-MsalClientApplication -ClientCertificate $ClientCertificate

Pipe in confidential client options object to get a confidential client application using a client certificate and

target a specific tenant.











RELATED LINKS