Syntax
New-VcsOAuthSecurityContext [[-VcsServer] <String>] -ApiToken <SecureString> [-IgnoreSslValidationErrors] [<CommonParameters>]Related Commands
Online VersionDetailed Description
Creates an OAuth2 security context object that you can use to authenticate a user with any VMware Cloud Service.Parameters
Return Type
VMware.VimAutomation.Vmc.Types.V1.VcsOAuthSecurityContextNotes
Examples
-------------------------- Example 1 --------------------------
$oauthCtx = New-VcsOAuthSecurityContext -ApiToken "a3f35067-80b5-44f0-a0bc-e19f2bc17fb7"
Creates an OAuth2 security context object by authenticating the user with an API token from the VMware Cloud Services web portal.
-------------------------- Example 2 --------------------------
$oauthCtx = New-VcsOAuthSecurityContext -VcsServer "console.cloud.vmware.com" -ApiToken "a3f35067-80b5-44f0-a0bc-e19f2bc17fb7"
Creates an OAuth2 security context object by authenticating the user with an API token from the VMware Cloud Services web portal for a particular instance of the service. In this example, that is the public commercial instance at https://console.cloud.vmware.com.
-------------------------- Example 3 --------------------------
$oauthCtx = New-VcsOAuthSecurityContext New-VcsOAuthSecurityContext ` -AppId "VOu3Vhx...d5jYPfS" ` -AppSecret "zfqytuK...G6mIGL8" ` -OrganizationId '22b98eec-cdc2-42b8-b770-835e72ecc7c3'
Creates an OAuth2 security context object by authenticating as a service application using the credentials of a Service-To-Service App registered with the VMware Cloud Services web portal.
-------------------------- Example 4 --------------------------
$oauthCtx = New-VcsOAuthSecurityContext New-VcsOAuthSecurityContext ` -AppId "VOu3Vhx...d5jYPfS" ` -AppSecret "zfqytuK...G6mIGL8" ` -OrganizationId '22b98eec-cdc2-42b8-b770-835e72ecc7c3' ` -RedirectUrl 'http://localhost:8877/powercli'
Creates an OAuth2 security context object by authenticating through the VMware Cloud Services web portal and providing the credentials of a Web App.
For this operation, you need to create a Web App in the VMware Cloud Services web portal: 1. Specify for the Redirect URL the value 'http://localhost:8877/powercli'. 2. Specify the permissions for the App (these permissions would be applied to the access tokens produced by the security context). 3. Copy the App ID and App Secret and store them in such a way that allows you to pass those values to your PowerShell script.