Skip to main content

Automatically Set Up a New Workspace: Workspace Provisioning in Torq

Create and activate new Torq workspaces for your organization automatically.

Updated over a week ago

Programmatically create new workspaces and get them operational by adding SSO settings, inviting users, creating integrations, workflows, step runners, and more. This allows quick and secure onboarding, control over workspace resources, and easy division of organizational setup and team automation.

Enable automatic workspace creation

Automatic workspace creation allows organizations, especially MSPs, to provision new environments programmatically. This ensures consistent configuration and controlled access from the start.

  1. Contact support: Reach out to Torq support to enable automatic workspace creation (available for MSPs).

  2. Assign permissions: Once enabled, users with the Owner role can create new workspaces.

How to use

Create a new workspace in Torq

Creating a workspace programmatically allows you to immediately configure users, SSO, integrations, and workflows. The generated access token is used to authenticate all subsequent setup steps.

  1. Add step: Use the Create a workspace step.

  2. (Optional) Set name: Pass workspace_name via the on-demand trigger and reference it with {{ $.event.workspace_name }}.

  3. (Optional) Copy SSO: Set Copy SSO config to true to duplicate IdP settings.

  4. Store credentials: Capture the generated client ID and client secret from the step output. The initiator is automatically added as an Owner.

Configure SSO settings

SSO configuration ensures secure and consistent authentication across workspaces. You can replicate existing identity provider settings to streamline onboarding.

  1. Enable SSO copy: Set Copy SSO config to true in the Create a workspace step.

  2. Replicate claim mappings:

    • Use List claim mappings in the current workspace.

    • Loop through the results.

    • Recreate or customize mappings in the new workspace.

Invite users

Inviting users programmatically accelerates onboarding and ensures correct role assignment from the beginning. This is especially useful when provisioning multiple users at once.

  1. Pass user list: Add a JSON parameter in the trigger with users and assigned roles.

  2. Loop through users: Iterate over the list.

  3. Send invitations: Use Invite a new user to send role-based invitations.

Create integrations

Integrations connect the new workspace to external systems and services. Automating integration setup ensures consistent configuration and secure credential handling.

  1. Create integration: Use the Create an integration step and define required vendor parameters.

  2. Access existing credentials: Reference credentials with $.integrations.<integration_name>.<parameter>.

  3. Secure secrets: Store credentials as workspace secrets or retrieve them from an external vault.

  4. Protect sensitive data: Set Discard data to Yes in Execution Options.

  5. Authenticate setup:

    • Select Set values separately from the Torq integration menu.

    • Provide the new workspace access token.

    • Configure integration-specific settings (for example, webhook URLs).

Implement step runners

Step runners enable execution of workflows that require self-hosted environments. Automating their creation ensures imported workflows function correctly in the new workspace.

  1. Pass runner list: Add a JSON parameter with predefined step runners and platforms.

  2. Loop through runners: Use Create Step Runner to generate runners.

  3. Deploy runners: Share the generated install commands with users for installation.

Import workflows

Importing workflows ensures operational readiness in the new workspace. You can replicate automation logic, maintain consistency, and optionally publish workflows immediately.

  1. Pass workflow list: Provide a JSON parameter identifying workflows to import.

  2. Retrieve workflows:

    • Use List workflows with the workflow name filter.

    • Use Retrieve a workflow to get the workflow ID.

    • Use Retrieve a revision to extract the YAML content.

  3. Import workflow: Use Import a workflow in the new workspace.

  4. (Optional) Publish workflow:

    • Use Publish a workflow in the new workspace.

    • Confirm publication by comparing current_revision_id and published_revision_id.

  5. (Optional) Add tags: Use Add a tag with the new workspace credentials.

Did this answer your question?