New-VcsOAuthSecurityContext
Creates an OAuth2 security context object that you can use to authenticate a user with any VMware Cloud Service.For more information about security contexts, see the about_security_context article.This command supports the following authentication options: - authenticate as a user who operates with the specified API token from the VMware Cloud Services web portal.- authenticate as a user by going to the VMware Cloud Services web portal and providing the credentials of the Web App registered with the VMware Cloud Services web portal. For this operation, you need to create a Web App in the VMware Cloud Services web portal with a redirect URL that is on a localhost and uses the http schema and a port that is free on the machine where PowerCLI is running. When you create the Web App in the web portal, take note of the App ID and secret.- authenticate as a service application by using the credentials of a Service-To-Service App. For this operation, you need to create a Service-to-Service App in the the VMware Cloud Services server. When you create the Service-to-Service application, add the application to the organization where you want it to operate. Take note of the App ID and secret.
Syntax
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required
|
ApiToken | SecureString | named |
|
Specifies the API token you want to use for authentication with the VMware Cloud Services server. The token is obtained from the VMware Cloud Services web portal. |
optional | IgnoreSslValidationErrors | SwitchParameter | named |
|
If specified, any errors with the SSL certificate of the server are ignored. |
optional | ProgressAction | ActionPreference | named |
|
|
optional | VcsServer | String | named |
|
Specifies the host name of the VMware Cloud Services API endpoint for the particular instance. The default value is `console.cloud.vmware.com`. You can find the value for your particular instance in the Developer Center section of the VMware Cloud Services web portal. |
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required
|
AppId | String | named |
|
Specifies the ID of an OAuth App registered in the VMware Cloud Services web portal. |
required
|
OrganizationId | String | named |
|
Specifies the ID of the organization where the access tokens from the security context are valid for. You can see the organization ID in the VMware Cloud Services web portal. |
required
|
RedirectUrl | Uri | named |
|
Specifies the Redirect URL of the Web App that you created in the VMware Cloud Services web portal for PowerCLI. This URL must be on localhost and a free port on the machine where PowerCLI is running. This URL must use the http schema. |
optional | AppSecret | SecureString | named |
|
Specifies the secret of an OAuth App registered in the VMware Cloud Services web portal. You can retrieve the secret from the portal only when you create the application. |
optional | IgnoreSslValidationErrors | SwitchParameter | named |
|
If specified, any errors with the SSL certificate of the server are ignored. |
optional | ProgressAction | ActionPreference | named |
|
|
optional | VcsServer | String | named |
|
Specifies the host name of the VMware Cloud Services API endpoint for the particular instance. The default value is `console.cloud.vmware.com`. You can find the value for your particular instance in the Developer Center section of the VMware Cloud Services web portal. |
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required
|
AppId | String | named |
|
Specifies the ID of an OAuth App registered in the VMware Cloud Services web portal. |
required
|
AppSecret | SecureString | named |
|
Specifies the secret of an OAuth App registered in the VMware Cloud Services web portal. You can retrieve the secret from the portal only when you create the application. |
required
|
OrganizationId | String | named |
|
Specifies the ID of the organization where the access tokens from the security context are valid for. You can see the organization ID in the VMware Cloud Services web portal. |
optional | IgnoreSslValidationErrors | SwitchParameter | named |
|
If specified, any errors with the SSL certificate of the server are ignored. |
optional | ProgressAction | ActionPreference | named |
|
|
optional | VcsServer | String | named |
|
Specifies the host name of the VMware Cloud Services API endpoint for the particular instance. The default value is `console.cloud.vmware.com`. You can find the value for your particular instance in the Developer Center section of the VMware Cloud Services web portal. |
Output
VMware.CloudServices.Types.V1.VcsOAuthSecurityContextExamples
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 ` -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 ` -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.
Related Commands
VcsOAuthSecurityContext
Creates an OAuth2 security context object that you can use to authenticate a user with any VMware Cloud Service.