Connect-FLC
Authenticates and prepares a connection for communicating to the specified Fusion 360 Manage tenant.
Syntax
Connect-FLC -Tenant <String> -ClientId <String> -ClientSecret <String> -UserId <String> [<CommonParameters>]
Connect-FLC [-UseSystemUserEmail] [<CommonParameters>]
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: |
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 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 commandlet 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.
When no tenant settings are passed to the commandlet, it checks if an active connection to a Vault exists that was configured via the Configuration Manager and uses the configured Tenant Settings.
If the -UseSystemUserEmail switch was passed the 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 $flcConnection variable in the powerShell session.
Examples
Connect to a Fusion 360 Manage tenant using Two-legged authentication
Connect-FLC -Tenant 'previewcoolorange' -ClientId 'nkerZQhAFEgt9f23Jk8aQ6B2NeRaLSjU' -ClientSecret 'w68qUITbY8RTjGCh' -UserId '[email protected]'
Connect to Fusion 360 Manage using a powerVault connection and the Tenant Setting stored in Vault
Import-Module powerVault
Open-VaultConnection -User 'coolOrange' # Vault user 'coolorange' has email address '[email protected]' assigned
Connect-FLC
$flcConnection.UserId # Returns '[email protected]'
Error handling, analyze why the connection could not be established
$result = Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'
if(-not $result) {
$result.Error #Returns "Authentication to Forge failed!"
}