# Connect-FLC Authenticates and prepares a connection for communicating to the specified Fusion 360 Manage tenant. ## Syntax ```powershell Connect-FLC -Tenant -ClientId -ClientSecret -UserId [] ``` ```powershell Connect-FLC [-UseSystemUserEmail] [] ``` ## Parameters | Type | Name | Description | Optional | |-----------------|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------| | String | Tenant | The name of the Fusion 360 Manage tenant, which is usually the first part of the URL to your Fusion 360 Manage Site: `https://.autodeskplm360.net/plm/mainDashboard` | no | | String | ClientId | The Client ID of the registered Forge app is your app’s username required for the two-legged authentication on the Forge Platform | no | | String | ClientSecret | The Client Secret is your app’s password and can be found next to the Client ID in the My Apps section | no | | String | UserId | The e-mail address of a particular user who will perform all the succeeding requests to Fusion 360 Manage | no | | SwitchParameter | UserSystemUserEmail | Whether to use the configured system user's email or the current users's email as UserId | yes | ## Return type **Bool**:\ **\$true** ← on success.\ **\$false** ← on failure with an additional property 'Error' containing the Exception/ErrorMessage. ## Remarks Authentication to the Fusion 360 Manage Tenant is achieved through the [2-legged OAuth flow]() provided by the Forge Platform. The cmdlets use a token that is retrieved using the provided **-ClientId** and **-ClientSecret** of the registered Forge app.\ Retrieve the [Client ID and Secret (see Step 3: Note Down Your Client ID and Secret)]() of the registered *powerPLM* app from the [Forge portal]() and make sure the Client ID is *whitelisted* in the [Fusion 360 Manage Configuration]().\ Because the [2-legged OAuth flow]() won’t have any information tied to a particular user, FusionLifecycle needs to know via **-UserId** the *e-mail address* of a [valid user]() in the system via the **-UserId** parameter. When the Cmdlet could successfully establish a connection to Fusion 360 Manage, the PowerShell variable [$flcConnection]() is created and lets you communicate to your tenant directly through the [Fusion 360 Manage APIs](). The cmdlet can be invoked **without arguments** in applications that are already connected to Vault (for example within the Vault Explorer or the Job Processor), so that the globally configured [Tenant Settings]() from the Configuration Manager dialog are used.\ In Job Processor environments the email address of the Vault user who queued the the currently processed job is automatically used for the login.\ For other Vault applications the email address of the logged-in Vault user is used as the *UserId* instead. If the **-UseSystemUserEmail** switch was passed the [system User Email address]() will be used as the *UserId*. If the application already has a Fusion 360 Manage connection for the passed tenant settings, the Cmdlet does not create a new connection but reuses the existing connection to create the [$flcConnection]() variable in the PowerShell session. ## Examples **Connect to a Fusion 360 Manage tenant using Two-legged authentication** ```powershell Connect-FLC -Tenant 'previewcoolorange' -ClientId 'nkerZQhAFEgt9f23Jk8aQ6B2NeRaLSjU' -ClientSecret 'w68qUITbY8RTjGCh' -UserId 'info@coolorange.com' ``` **Connect to Fusion 360 Manage using a powerVault connection and the Tenant Setting stored in Vault** ```powershell Import-Module powerVault Open-VaultConnection -User 'coolOrange' # Vault user 'coolorange' has email address 'info@coolorange.com' assigned Connect-FLC $flcConnection.UserId # Returns 'info@coolorange.com' ``` **Error handling, analyze why the connection could not be established** ```powershell $result = Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId 'your_email@example.com' if(-not $result) { $result.Error #Returns "Authentication to Forge failed!" } ```