Connect-FLC

A lightweight wrapper around Connect-APS that uses 3-legged Autodesk Platform Services (APS) authentication to connect to the specified Fusion Manage tenant.

Syntax

Connect-FLC -Tenant <String> [-User <String>] [<CommonParameters>]
<#
PARAMETER
    -Tenant
        Required                true

    -User
        Required                false

    <CommonParameters>
        This cmdlet supports the common parameters: ErrorAction, ErrorVariable
#>

Provide credentials for your own Autodesk app directly:

Connect-FLC -Tenant <String> -ClientId <String> [-ClientSecret <String>] [-CallbackUrl <Uri>] [-User <String>] [<CommonParameters>]
<#
PARAMETER
    -Tenant
        Required                true

    -ClientId
        Required                true

    -ClientSecret
        Required                false

    -CallbackUrl
        Required                false

    -User
        Required                false

    <CommonParameters>
        This cmdlet supports the common parameters: ErrorAction, ErrorVariable
#>

Parameters

Type

Name

Description

Default value

String

Tenant

Name of the Fusion Manage tenant to connect to. This is usually the first part of its URL: https://<Tenant>.autodeskplm360.net/.


Parameters inherited from Connect-APS:

String

User

Email address of the Autodesk user to impersonate when running on the Job Processor. Fusion Manage operations & APS calls will be executed on behalf of this Autodesk ID

The Autodesk ID signed in on the workstation

String

ClientId

The Client ID of your own Autodesk app that needs authorization

Client ID of the default coolOrange app:
baEth24w4YXeBoGYvrdKTHlAi2HfvYtLabmmX0Hxwh047KuO

String

ClientSecret

The Client Secret shown next to the Client ID is the password of your Autodesk app.
Only required for Traditional Web App apps. Not used for Desktop, Mobile, Single-Page App types.

–

Uri

CallbackUrl

A local redirect URL configured for your Autodesk app. After sign-in in the system browser, Autodesk redirects here so the cmdlet can receive the authorization response via a local HTTP listener.

Important: Use a free local port and path (e.g. http://localhost:50000/PAPS/callback) which must exactly match the app settings.

http://localhost:8080/

Return type

Bool:
$true ← on success.
$false ← on failure. Exception/ErrorMessage can be accessed through the additional property ‘Error’ or using $Error.

Remarks

This cmdlet must be called before using any other Fusion Manage cmdlet.

It invokes Connect-APS, passing any specified -User, -ClientId, -ClientSecret and -CallbackUrl parameters to authenticate with Autodesk Platform Services (APS).

After successful authentication, the PowerShell variable $FLCTenant is created. It allows to communicate with the specified -Tenant directly through the Fusion Manage APIs.

Besides Fusion Manage, the $APSConnection object can also be used to call other APS endpoints, such as Autodesk Forma or BIM 360.
The 3-legged authentication details are available throught:

  • $APSConnection.User

  • $APSConnection.Headers

By default, the Autodesk ID signed-in on the computer is used when no -User is specified. This user must grant consent to the coolOrange app once.

For this to work, the Fusion Manage system administrator must have already whitelisted the coolOrange app’s Client ID. The same app can also be whitelisted in other Autodesk services, such as Forma or BIM 360, if required.
Alternatively, you can provide your own Autodesk App credentials (-ClientId, -ClientSecret, -CallbackUrl). In this case, your must whitelisted your own app instead.

For more details about authentication, consent, saved sessions, and Job Processor behavior, see the Connect-APS documentation.

Examples

Connect to Fusion Manage using the currently signed-in Autodesk ID

Connect-FLC -Tenant 'previewcoolorange' # Uses the currently signed-in Autodesk ID and 3-legged OAuth; Connect-APS opens a browser if user consent is required!

$global:flcTenant.Url
#Returns: "https://previewcoolorange.fusionmanage.autodesk.com"

$global:APSConnection.User
#Returns: "your_email@example.com"

Reuse the APS session from Vault

Open-VaultConnection # When a Vault connection is available, an existing APS session can be reused interactively

Connect-FLC -Tenant 'previewcoolorange' # Reuses, if available, the APS session for the currently signed-in Autodesk ID

<#
   The APS session remains valid for up to 15 days. Each re-connect during this period automatically extends the session.
   After 15 days without API activity, the user must grant consent again in the browser!
#>

Impersonate Fusion Manage - and other APS calls - on the Job Processor as the job submitter

Connect-FLC -Tenant 'previewcoolorange' -User $job.SubmittedByAutodeskId #Authenticates as the Autodesk ID of the user that submitted the job, who must have granted consent previously

$flcItems = Get-FLCItems -Workspace 'Tasks' -Filter 'Market Analysis'


#Use the same APS connection to access other APS APIs:

$hub = $APSConnection.Hubs["John's Hub"]

$other_APS_endpoint_response = Invoke-RestMethod -Method Get -Headers $APSConnection.Headers `
    -Uri "https://developer.api.autodesk.com/project/v1/hubs/$($hub.id)/projects" # see https://aps.autodesk.com/en/docs/data/v2/tutorials/download-file

See the complete example for how the according Autodesk user grants consent on a workstation before submitting a job:
Connect-APS: Run APS calls on Job Processor, impersonating the Autodesk ID of user who submitted the job

Error handling, analyze connection failures using your own Autodesk App

$result = Connect-FLC -Tenant 'previewcoolorange' -ClientId 'nkerZQhAFEgt9f23Jk8aQ6B2NeRaLSjU' -CallbackUrl 'http://localhost:6666/callback'

if(-not $result) {
   $result.Error # Returns "the Autodesk App is not whitelisted in the Fusion Manage tenant"
}


# Alternatively, for jobs:

Connect-FLC -Tenant 'previewcoolorange' -ClientId 'nkerZQhAFEgt9f23Jk8aQ6B2NeRaLSjU' -ClientSecret 'w68qUITbY8RTjGCh' -ErrorAction Stop
<#
Terminates with:
Job processing requires Autodesk Platform Services authentication! Please sign-in using your Autodesk ID and click the 'Authorize APS Access' button in the powerJobs.exe Tools menu.
#>