# 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](https://forge.autodesk.com/en/docs/oauth/v2/tutorials/get-2-legged-token/) 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](https://forge.autodesk.com/en/docs/oauth/v2/tutorials/create-app/#step-3-note-down-your-client-id-and-secret) of the registered *powerPLM* app from the [Forge portal](https://forge.autodesk.com/) and make sure the Client ID is *whitelisted* in the {ref}`Fusion 360 Manage Configuration `.\ Because the [2-legged OAuth flow](https://forge.autodesk.com/en/docs/oauth/v2/tutorials/get-2-legged-token/) won’t have any information tied to a particular user, FusionLifecycle needs to know via **-UserId** the *e-mail address* of a {ref}`valid user ` in the system via the **-UserId** parameter. When the commandlet could successfully establish a connection to Fusion 360 Manage, the powershell variable {doc}`$flcConnection ` is created and lets you communicate to your tenant directly through the [Fusion 360 Manage APIs](http://help.autodesk.com/view/PLM/ENU/?guid=FLC_RestAPI_Resource_Endpoints_html). When no tenant settings are passed to the commandlet, it checks if an active connection to a Vault exists that was configured via the {doc}`Configuration Manager ` and uses the configured Tenant Settings.\ If the **-UseSystemUserEmail** switch was passed the {ref}`system User Email address ` will be used as the **UserId**.\ When the switch is not passed and the commandlet is executed in a job processor evironment the email address of the vault user that queued the currently processed job is used as the **UserId**.\ When the commandlet is not called in a job processor environment and no parameters are passed, the email address of the vault user that owns the vault connection is used. If the application already has a Fusion 360 Manage connection for the passed tenant settings, the commandlet does not create a new connection but reuses the existing connection to create the {doc}`$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!" } ```