Connect-Vmc
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.
Syntax
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
optional | 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 | NotDefault | SwitchParameter | named |
|
Specifies that you do not want to save the specified servers as default servers (the $global:defaultVmcServers PowerShell variable). |
optional | ProgressAction | ActionPreference | named |
|
|
optional | SaveApiToken | SwitchParameter | named |
|
Indicates 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. |
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required
|
Menu | SwitchParameter | named |
|
Indicates 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. |
optional | ProgressAction | ActionPreference | named |
|
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required
|
OAuthSecurityContext | OAuth2SecurityContext | named |
|
Specifies 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). |
optional | NotDefault | SwitchParameter | named |
|
Specifies that you do not want to save the specified servers as default servers (the $global:defaultVmcServers PowerShell variable). |
optional | ProgressAction | ActionPreference | named |
|
|
optional | Server | String[] | named |
|
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. |
Output
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.
Related Commands
Vmc
This cmdlet establishes a connection to a VMware Cloud on AWS server.
This cmdlet closes the connection to the servers specified by the Server parameter.