PowerCLI Reference

Connect-Vmc

Synopsis

This cmdlet establishes a connection to a VMware Cloud on AWS server.

Syntax

Connect-Vmc [-ApiToken <SecureString>] [-NotDefault] [-SaveApiToken] [<CommonParameters>]

Connect-Vmc -Menu [<CommonParameters>]

Connect-Vmc [[-Server] <String[]>] [-NotDefault] -OAuthSecurityContext <OAuth2SecurityContext> [<CommonParameters>]

Related Commands

Online Version
Disconnect-Vmc

Detailed Description

This cmdlet establishes a connection to ? VMware managed cloud such as the VMware Cloud on AWS server. The cmdlet requires an OAuth security context in order to authenticate the user. If you want to specify an API token directly, use the -ApiToken parameter.


When running, the cmdlet performs the following steps: 1. If the Menu parameter is specified, a list of the latest connected VMware Cloud on AWS servers appears. 2. If neither the Menu nor the server is specified, the default "vmc.vmware.com" value is used. 3. If neither the ApiToken parameter nor the OAuthSecurityContext parameter is specified, the local credential store is searched for a previously saved one. If an API token is not found, an error report is displayed. 4. When using the Server and ApiToken parameters, a new OAuth security context is created for the token and is used to authenticate the user. 5. If the OAuthSecurityContext parameter is specified, the security context is used to authenticate the user.


Note: If PowerShell runs in non-interactive mode, you are not prompted for credentials.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
ServerString[]Specifies the IP address or the DNS name of the VMware managed cloud service. If not specified, the cmdlet assumes that you are connecting to the public commercial instance and the default value of `vmc.vmware.com` is used.falseFalse
ApiTokenSecureStringSpecifies 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.falseFalse
MenuSwitchParameterIndicates that you want to select a connection server from a list of recently connected servers. If the Menu parameter is set to $true, the cmdlet retrieves a list of the last visited servers and enters a nested command prompt, so that you can select a server from the list.trueFalse
NotDefaultSwitchParameterSpecifies that you do not want to save the specified servers as default servers (the $global:defaultVmcServers PowerShell variable).falseFalse
OAuthSecurityContextOAuth2SecurityContextSpecifies the OAuth security context that you can use to authenticate the user. For more information about security contexts, see the about_security_context article (about_security_context.html) and the [New-VcsOAuthSecurityContext cmdlet](New-VcsOAuthSecurityContext.md).trueFalse
SaveApiTokenSwitchParameterIndicates that the API token that you use for establishing the server session is saved to a local credential store and can be used automatically when connecting again to the same server.falseFalse

Return Type

VMware.VimAutomation.Vmc.Types.V1.VmcServer

Notes

Examples

-------------------------- Example 1 --------------------------

Connect-Vmc -ApiToken $apiToken

Connects to a VMware Cloud on AWS server.

-------------------------- Example 2 --------------------------

Connect-Vmc -ApiToken $script:apiToken -SaveApiToken

Connects to a VMware Cloud on AWS server by specifying the related secure connection token and saving it for later usage.

-------------------------- Example 3 --------------------------

$oauthSecurityContext = New-VcsOAuthSecurityContext -ApiToken $script:apiToken
Connect-Vmc -OAuthSecurityContext $oauthSecurityContext

Connects to a VMware Cloud on AWS server by specifying an OAuth security context. In this case, you can create it by using the API token.

-------------------------- Example 4 --------------------------

$oauthSecurityContext = New-VcsOAuthSecurityContext -VcsServer "console.cloud.vmware.com" -ApiToken $script:apiToken
Connect-Vmc -Server "vmc.vmware.com" -OAuthSecurityContext $oauthSecurityContext

Connects to a VMware Cloud on AWS server by explicitly specifying the host name of the VMware Cloud Services and the VMware Cloud on AWS server for the commercial instance. If you want to use a different instance, you can find the corresponding host names in the Developer Center section of the web portal.


Copyright © VMware, Inc. All rights reserved.