New-VcfOAuthSecurityContext Command | Vmware PowerCLI Reference

New-VcfOAuthSecurityContext

Creates an OAuth2 security context object that you can use to authenticate to any system that is configured with VCF SSO.

Syntax

New-VcfOAuthSecurityContext
-ApiToken < SecureString >
-IdentityBrokerHostname < String >
[-IgnoreSslValidationErrors ]
[-Tenant < String > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
ApiToken SecureString named
Specifies the API token which will be used to obtain a bearer token. API tokens can only be created on VCF 9.1 and later.
required
IdentityBrokerHostname String named
Specifies the hostname of the VCF Identity Broker where the token exchange will be performed.
optional IgnoreSslValidationErrors SwitchParameter named
optional Tenant String named
Specifies the VCF Identity Broker tenant.

Output

VMware.Vcf.Sso.Types.VcfOAuthSecurityContext

Examples

Example 1

$oauthCtx = New-VcfOAuthSecurityContext `
    -IdentityBrokerHostname "<VCF Identity Broker hostname>" `
    -ApiToken "..." `

Creates an OAuth2 security context object by authenticating against the specified VCF Identity Broker and the default tenant.

Example 2

$oauthCtx = New-VcfOAuthSecurityContext `
    -IdentityBrokerHostname "<VCF Identity Broker hostname>" `
    -ApiToken "..." `
    -Tenant "<Custom Tenant>

Creates an OAuth2 security context object by authenticating against the specified VCF Identity Broker and tenant.

Related Commands

VcfOAuthSecurityContext

Creates an OAuth2 security context object that you can use to authenticate to any system that is configured with VCF SSO.