Introduction to tg CLI (JavaScript)

The tg CLI is a fully featured CLI tool utilising the Twingate GraphQL APIs. It is open-source and written in JavaScript so Node or Deno developers can extend or customise for their own use cases.

Pre-built binaries are provided for all major platforms. Users familiar with Python development may prefer the Python CLI.

🚧

Open Source contribution

The tg CLI tool is an Open Source project developed and maintained outside of our product engineering teams. For support regarding this tool please visit the Github issues page.

Getting Started

Download binaries for Windows, Mac or Linux from our release page on Github.

Unzip the package and insert the following in your terminal:

# ./tg --help

  Usage:   tg   
  Version: 0.1.0

  Description:

    CLI for Twingate

  Options:

    -h, --help                      - Show this help.                                                                                       
    -V, --version                   - Show the version number for this program.                                                             
    -a, --account-name  <string>    - Twingate account name                                                                                 
    -l, --log-level     [logLevel]  - Log level                                  (Default: "INFO", Values: "TRACE", "DEBUG", "INFO", "WARN",
                                                                                 "ERROR", "SEVERE", "FATAL", "QUIET", "SILENT")             

  Commands:

    export     - Export from account to various formats      
    import     - Import from excel file to a Twingate account
    resource   - Twingate resources                          
    group      - Twingate groups                             
    user       - Twingate users                              
    network    - Twingate networks                           
    connector  - Twingate connectors                         
    device     - Twingate devices                            
    service    - Twingate services

📘

The tg CLI tool asks for Twingate Account and API Key whenever a command is called and the option to save the Twingate Account and API key is also given. See the example below.

# ./tg export
 ? Enter Twingate account: › exampleAccount
 ? Enter API key: › **************************************************************************************************************************************
 ? Save account and API key to file? › Yes
[INFO]    Configuration file saved.
[SUCCESS] Export to 'exampleAccount-2022-06-08_16-57-01.xlsx' completed.

User Command

The user command provides the ability to list all users.

# ./tg user --help

  Usage:   tg user
  Version: 0.1.0  

  Description:

    Twingate users

  Options:

    -h, --help                      - Show this help.                         
    -a, --account-name  <string>    - Twingate account name                   
    -l, --log-level     [logLevel]  - Log level              (Default: "INFO")

  Commands:

    list                                        - Get list of users

List All Users

# ./tg user list
[INFO]    Using Twingate account: 'exampleAccount'
┌──────────────────┬───────────┬───────────┬───────────┬──────────┬───────────────────────┬────────────────────────────────────────────────────────────────────────────────────────┬─────────┬─────────┬─────────────────┐
│ id               │ createdAt │ updatedAt │ firstName │ lastName │ email                 │ avatarUrl                                                                              │ isAdmin │ state   │ groups          │
├──────────────────┌───────────┌───────────┌───────────┌──────────┌───────────────────────┌────────────────────────────────────────────────────────────────────────────────────────┌─────────┌─────────┌──────────────────
│ VXNlcjoxMzY3Ng== │ 6/7/22    │ 6/9/22    │           │          │ [email protected] │                                                                                        │ FALSE   │ Pending │ Everyone, test1 │
├──────────────────┌───────────┌───────────┌───────────┌──────────┌───────────────────────┌────────────────────────────────────────────────────────────────────────────────────────┌─────────┌─────────┌──────────────────
│ VXNlcjoxMzYxMA== │ 5/23/22   │ 6/10/22   │ aaaa      │ bbbbbb   │ [email protected]     │                                                                                        │ TRUE    │ Active  │ Everyone, test1 │
└──────────────────┮───────────┮───────────┮───────────┮──────────┮───────────────────────┮────────────────────────────────────────────────────────────────────────────────────────┮─────────┮─────────┮─────────────────┘

Group Command

The group command provides the ability to list, create, remove and copy groups as well as add users and resources to a group.

# ./tg group --help

  Usage:   tg group
  Version: 0.1.0   

  Description:

    Twingate groups

  Options:

    -h, --help                      - Show this help.                         
    -a, --account-name  <string>    - Twingate account name                   
    -l, --log-level     [logLevel]  - Log level              (Default: "INFO")

  Commands:

    list                                                   - Get list of groups      
    create        <name> [UserIds...]                      - Create a group          
    remove        <id>                                     - Remove a group          
    remove_bulk   [groupIds...]                            - Remove groups bulk      
    add_user      <groupNameOrId> [userIds...]             - Add users to a group    
    add_resource  <groupNameOrId> [resourceNamesOrIds...]  - Add resources to a group
    copy          <source> <destination>                   - Copy a group

List All Groups

# ./tg group list
[INFO]    Using Twingate account: 'exampleAccount'
┌──────────────────┬───────────┬───────────┬──────────────┬──────────┬────────┐
│ id               │ createdAt │ updatedAt │ name         │ isActive │ type   │
├──────────────────┌───────────┌───────────┌──────────────┌──────────┌─────────
│ R3JvdXA6MzE1OTY= │ 5/4/22    │ 5/4/22    │ Everyone     │ TRUE     │ System │
├──────────────────┌───────────┌───────────┌──────────────┌──────────┌─────────
│ R3JvdXA6MzQ2NTE= │ 6/8/22    │ 6/8/22    │ exampleGroup │ TRUE     │ Manual │
├──────────────────┌───────────┌───────────┌──────────────┌──────────┌─────────
│ R3JvdXA6MzI4ODM= │ 5/17/22   │ 5/17/22   │ test_group   │ TRUE     │ Manual │
└──────────────────┮───────────┮───────────┮──────────────┮──────────┮────────┘

Create A New Group

# ./tg group create "exampleGroup"
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] New group named 'exampleGroup' created with id 'R3JvdXA6MzQ2NTM='.

Create A New Group With Added Users

📘

The users must already exist in Twingate.
User ID must be used instead email address.

# ./tg group create "exampleGroup2" "VXNlcjoxMzY3Ng==" "VXNlcjoxMzYxMA=="
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] New group named 'exampleGroup2' created with id 'R3JvdXA6MjI4MDc=' with added users '[email protected]: VXNlcjoxMzY3Ng==' '[email protected]: VXNlcjoxMzYxMA=='

Remove A Group

#. /tg group remove "R3JvdXA6MzQ2NTM="
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] Removed group with id 'R3JvdXA6MzQ2NTM='

Add Users To A Group

📘

The users must already exist in Twingate.
User ID must be used instead email address.

# ./tg group add_user "exampleGroup" "VXNlcjoxMzY3Ng==" "VXNlcjoxMzYxMA=="
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] Added users '[email protected]: VXNlcjoxMzY3Ng==' '[email protected]: VXNlcjoxMzYxMA==' to group 'exampleGroup: R3JvdXA6MzQ2NTM='

Add Groups To A Resource

📘

The resource must already exist in Twingate.

# ./tg group add_resource "exampleGroup" "exampleResource1" "exampleResource2"
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] Added resources 'exampleResource1: UmVzb3VyY2U6MzU5NDg2' 'exampleResource2: UmVzb3VyY2U6MzU5NDg3' to group 'exampleGroup: R3JvdXA6MjI3NTI='

Copy A Group

📘

All users of the source group is copied to the destination group.

# ./tg group copy "exampleGroup2" "exampleGroup5"
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] New group named 'exampleGroup9' created as a copy of 'exampleGroup2'

Network Command

The network command provides the ability to list and create remote networks.

# ./tg network --help

  Usage:   tg network
  Version: 0.1.0     

  Description:

    Twingate networks

  Options:

    -h, --help                      - Show this help.                         
    -a, --account-name  <string>    - Twingate account name                   
    -l, --log-level     [logLevel]  - Log level              (Default: "INFO")

  Commands:

    list            - Get list of networks
    create  <name>  - Create a network

List All Remote Networks

# ./tg network list
[INFO]    Using Twingate account: 'exampleAccount'
┌──────────────────────────┬──────┬──────────┬───────────┬───────────┬───────────────────────────────┐
│ id                       │ name │ isActive │ createdAt │ updatedAt │ connectors                    │
├──────────────────────────┌──────┌──────────┌───────────┌───────────┌────────────────────────────────
│ UmVtb3RlTmV0d29yazo4MDEw │ 123  │ TRUE     │ 6/6/22    │ 6/6/22    │ tourmaline-crow, maroon-rhino │
├──────────────────────────┌──────┌──────────┌───────────┌───────────┌────────────────────────────────
│ UmVtb3RlTmV0d29yazo4MDEy │ 234  │ TRUE     │ 6/9/22    │ 6/9/22    │                               │
└──────────────────────────┮──────┮──────────┮───────────┮───────────┮───────────────────────────────┘

Create A New Remote Network

# ./tg network create "myNewRemoteNetwork"
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] New network named 'myNewRemoteNetwork' created with id 'UmVtb3RlTmV0d29yazo4MDEz'

Connector Command

The connector command provides the ability to list and create connectors.

# ./tg connector --help

  Usage:   tg connector
  Version: 0.1.0       

  Description:

    Twingate connectors

  Options:

    -h, --help                      - Show this help.                         
    -a, --account-name  <string>    - Twingate account name                   
    -l, --log-level     [logLevel]  - Log level              (Default: "INFO")

  Commands:

    list                                    - Get list of connectors
    create  <remoteNetworkNameOrId> [name]  - Create a connector

List All Connectors

# ./tg connector list
[INFO]    Using Twingate account: 'exampleAccount'
┌──────────────────────┬─────────────────────┬───────────┬───────────┬─────────────────┬────────────────────────┬────────────────────┐
│ id                   │ name                │ createdAt │ updatedAt │ lastHeartbeatAt │ state                  │ remoteNetworkLabel │
├──────────────────────┌─────────────────────┌───────────┌───────────┌─────────────────┌────────────────────────┌─────────────────────
│ Q29ubmVjdG9yOjUxOQ== │ lavender-pheasant   │ 6/13/22   │ 6/13/22   │                 │ Offline - No Heartbeat │ 456                │
├──────────────────────┌─────────────────────┌───────────┌───────────┌─────────────────┌────────────────────────┌─────────────────────
│ Q29ubmVjdG9yOjUxNQ== │ maroon-rhino        │ 6/6/22    │ 6/6/22    │                 │ Offline - No Heartbeat │ 123                │
├──────────────────────┌─────────────────────┌───────────┌───────────┌─────────────────┌────────────────────────┌─────────────────────
│ Q29ubmVjdG9yOjUyMQ== │ mysterious-barnacle │ 6/13/22   │ 6/13/22   │                 │ Offline - No Heartbeat │ 234                │
├──────────────────────┌─────────────────────┌───────────┌───────────┌─────────────────┌────────────────────────┌─────────────────────
│ Q29ubmVjdG9yOjUyMA== │ smooth-auk          │ 6/13/22   │ 6/13/22   │                 │ Offline - No Heartbeat │ 456                │
├──────────────────────┌─────────────────────┌───────────┌───────────┌─────────────────┌────────────────────────┌─────────────────────
│ Q29ubmVjdG9yOjUxNA== │ tourmaline-crow     │ 6/6/22    │ 6/6/22    │                 │ Offline - No Heartbeat │ 123                │
└──────────────────────┮─────────────────────┮───────────┮───────────┮─────────────────┮────────────────────────┮────────────────────┘

Create A New Connector

📘

The remote network must already exist in Twingate.

# ./tg connector create "myRemoteNetwork"  "myNewConnector" 
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] New Connector named 'myNewConnector' created with id 'UmVtb3RlTmV0d29yazo4MDEz' in network 'myRemoteNetwork' with tokens:
ACCESS_TOKEN=xxxxxxxxxx
REFRESH_TOKEN=xxxxxxxxxx

Resource Command

The resource command provides the ability to list, create, remove resources as well as add groups to a resource.

# ./tg resource --help

  Usage:   tg resource
  Version: 0.1.0      

  Description:

    Twingate resources

  Options:

    -h, --help                      - Show this help.                         
    -a, --account-name  <string>    - Twingate account name                   
    -l, --log-level     [logLevel]  - Log level              (Default: "INFO")

  Commands:

    list                                                   - Get list of resources   
    create       <remoteNetworkNameOrId> <name> <address>  - Create a resource       
                 [groupNamesOrIds...]                                                
    remove       <id>                                      - Remove a resource       
    remove_bulk  [resourceIds...]                          - Remove resources bulk   
    add_group    <resourceNameOrId> [groupNamesOrIds...]   - Add groups to a resource

List All Resources

# ./tg resource list
[INFO]    Using Twingate account: 'exampleAccount'
┌──────────────────────┬────────────────────────┬───────────┬───────────┬──────────┬────────────────────┬─────────────┬───────────────────────┬────────────────────┬────────────────────┬───────────────────┬────────────────────┬───────────────────┐
│ id                   │ name                   │ createdAt │ updatedAt │ isActive │ remoteNetworkLabel │ addressType │ addressValue          │ protocolsAllowIcmp │ protocolsTcpPolicy │ protocolsTcpPorts │ protocolsUdpPolicy │ protocolsUdpPorts │
├──────────────────────┌────────────────────────┌───────────┌───────────┌──────────┌────────────────────┌─────────────┌───────────────────────┌────────────────────┌────────────────────┌───────────────────┌────────────────────┌────────────────────
│ UmVzb3VyY2U6MzU5NDM3 │ r8888                  │ 6/10/22   │ 6/10/22   │ TRUE     │ 123                │ DNS         │ 2.2.2.2               │ TRUE               │ ALLOW_ALL          │                   │ ALLOW_ALL          │                   │
├──────────────────────┌────────────────────────┌───────────┌───────────┌──────────┌────────────────────┌─────────────┌───────────────────────┌────────────────────┌────────────────────┌───────────────────┌────────────────────┌────────────────────
│ UmVzb3VyY2U6MzU5NDQ3 │ tg test                │ 6/13/22   │ 6/13/22   │ TRUE     │ 123                │ IP          │ 1.1.1.1               │ TRUE               │ ALLOW_ALL          │                   │ ALLOW_ALL          │                   │
├──────────────────────┌────────────────────────┌───────────┌───────────┌──────────┌────────────────────┌─────────────┌───────────────────────┌────────────────────┌────────────────────┌───────────────────┌────────────────────┌────────────────────
│ UmVzb3VyY2U6MzU5NDMz │ tg_resource_name_111   │ 6/10/22   │ 6/10/22   │ TRUE     │ 123                │ DNS         │ 3.3.3.3               │ TRUE               │ ALLOW_ALL          │                   │ ALLOW_ALL          │                   │
├──────────────────────┌────────────────────────┌───────────┌───────────┌──────────┌────────────────────┌─────────────┌───────────────────────┌────────────────────┌────────────────────┌───────────────────┎────────────────────┎───────────────────┘

Create A New Resource

📘

The remote network must already exist in Twingate.

# ./tg resource create "myRemoteNetwork" "myNewResource" "1.1.1.1" 
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] New resource named 'myNewResource' created with id 'UmVzb3VyY2U6MzU5NDQ4' in network 'myRemoteNetwork'

Create A New Resource With Added Groups

📘

The groups must already exist in Twingate.

# ./tg resource create "myRemoteNetwork" "myNewResource2" "2.2.2.2" "testGroup1" "testGroup2"
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] New resource named 'myNewResource2' created with id 'UmVzb3VyY2U6MzU5NDcy' in network 'myRemoteNetwork' with added groups 'testGroup1: R3JvdXA6MjI3NTI=' 'testGroup2: R3JvdXA6MjI3NTM='

Add Groups To A Resource

📘

The resource and groups must already exist in Twingate.

# ./tg resource add_group "myResource" "testGroup3" "testGroup4"
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] Added groups 'testGroup3: R3JvdXA6MjI4MDM=' 'testGroup4: R3JvdXA6MjI4MDU=' to resource 'myResource: UmVzb3VyY2U6MzU5NDg2'

Device Command

The device command provides the ability to list all devices.

# ./tg device --help

  Usage:   tg device
  Version: 0.1.0    

  Description:

    Twingate devices

  Options:

    -h, --help                      - Show this help.                         
    -a, --account-name  <string>    - Twingate account name                   
    -l, --log-level     [logLevel]  - Log level              (Default: "INFO")

  Commands:

    list  - Get list of devices

List All Devices

# ./tg device list
[INFO]    Using Twingate account: 'exampleAccount'
┌──────────────────────┬────────────────────────┬───────────┬─────────────────┬───────────────────┬───────────────────────┬────────────┬─────────┬──────────────┬───────────────┬─────────────────────┬─────────────────────────┬─────────────┬──────────────────────┬─────────────────────┬───────────────────────┐
│ id                   │ name                   │ isTrusted │ lastConnectedAt │ lastFailedLoginAt │ lastSuccessfulLoginAt │ deviceType │ osName  │ osVersion    │ clientVersion │ hardwareModel       │ hostname                │ username    │ serialNumber         │ manufacturerName    │ userLabel             │
├──────────────────────┌────────────────────────┌───────────┌─────────────────┌───────────────────┌───────────────────────┌────────────┌─────────┌──────────────┌───────────────┌─────────────────────┌─────────────────────────┌─────────────┌──────────────────────┌─────────────────────┌────────────────────────
│ RGV2aWNlOjIwMDgzMA== │ XXXXXX MacBook Pro     │ FALSE     │                 │                   │ 5/24/22               │ Laptop     │ MacOS   │ 12.3.1       │ 1.0.20.3453   │ MacBookPro18,3      │ xxxxx-macbook-pro.local │ XXXXXXXXXXX │ XXXXXXXXXX           │ Apple Inc.          │ [email protected]     │
├──────────────────────┌────────────────────────┌───────────┌─────────────────┌───────────────────┌───────────────────────┌────────────┌─────────┌──────────────┌───────────────┌─────────────────────┌─────────────────────────┌─────────────┌──────────────────────┌─────────────────────┌────────────────────────
│ RGV2aWNlOjE5NDU5MA== │ XXXXXX                 │ FALSE     │                 │                   │ 5/16/22               │ Desktop    │ Windows │ 10.0.19043.0 │ 1.0.17.10571  │ System Product Name │ XXXXXX                  │ XXXXX\XXXX │ System Serial Number │ System manufacturer │ [email protected] │
└──────────────────────┮────────────────────────┮───────────┮─────────────────┮───────────────────┮───────────────────────┮────────────┮─────────┮──────────────┮───────────────┮─────────────────────┮─────────────────────────┮─────────────┮──────────────────────┮─────────────────────┮───────────────────────┘

Service Command

The service command provides the ability to list, create, remove service accounts as well as create service key and add resources to a service account.

# ./tg service --help

  Usage:   tg service
  Version: 0.1.0             

  Description:

    Twingate service

  Options:

    -h, --help                      - Show this help.                         
    -a, --account-name  <string>    - Twingate account name                   
    -l, --log-level     [logLevel]  - Log level              (Default: "INFO")

  Commands:

    list                                                               - Get list of services        
    create        <name> [resourceNamesOrIds...]                       - Create a service            
    remove        <id>                                                 - Remove a service            
    add_resource  <serviceAccountId> [resourceNamesOrIds...]           - Add resources to a service  
    key_create    <serviceAccountId> <keyName> <expirationTimeInDays>  - Create a service account key

List All Service Accounts

# ./tg service list
[INFO]    Using Twingate account: 'exampleAccount'
┌──────────────────────────────────────────────────────────────────────┬──────────────┬───────────┬───────────┬───────────┬────────────────┐
│ id                                                                   │ name         │ createdAt │ updatedAt │ resources │ keysTotalCount │
├──────────────────────────────────────────────────────────────────────┌──────────────┌───────────┌───────────┌───────────┌─────────────────
│ U2VydmljZUFjY291bnQ6MzYyNDNiMDQtZGE1ZC00Y2IyLThjOGYtYmExYzE2NWQxZTFj │ test account │ 6/13/22   │ 6/13/22   │           │ 0              │
└──────────────────────────────────────────────────────────────────────┮──────────────┮───────────┮───────────┮───────────┮────────────────┘

Create A New Service Account

# ./tg service create myNewServiceAccount
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] New service named 'myNewServiceAccount' created with id 'U2VydmljZUFjY291bnQ6Zjc3MDI4OTktMmJlNC00MTdlLWE5ZDctZGYyMmJlZDJiZmIx'.

Create A New Service Account With Added Resources

📘

The resources must already exist in Twingate.

# ./tg service create "myNewServiceAccount2" "myResource1" "myResource2"
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] New service named 'myNewServiceAccount2' created with id 'U2VydmljZUFjY291bnQ6YWIwZjZmMTYtYmNjMy00N2EyLTlmY2MtZmY5ODI0YmE5Y2Uw' with added resources 'myResource1: UmVzb3VyY2U6MzU5NDg2' 'myResource2: UmVzb3VyY2U6MzU5NDg3'

Remove A Service Account

📘

The service account cannot be removed unless it has 0 active keys.

# ./tg service remove U2VydmljZUFjY291bnQ6OWI5MDc1YWItZGYwZC00NWFlLTg2NzEtYzExMzMxOTA3OTMx
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] Removed service with id 'U2VydmljZUFjY291bnQ6OWI5MDc1YWItZGYwZC00NWFlLTg2NzEtYzExMzMxOTA3OTMx'.

Add Resources To A Service Account

📘

The resources must already exist in Twingate.

# ./tg service add_resource "U2VydmljZUFjY291bnQ6MzYyNDNiMDQtZGE1ZC00Y2IyLThjOGYtYmExYzE2NWQxZTFj" "myResource1" "myResource2"
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] Added resources 'myResource1: UmVzb3VyY2U6MzU5NDg2' 'myResource2: UmVzb3VyY2U6MzU5NDg3' to service 'myNewServiceAccount: U2VydmljZUFjY291bnQ6Zjc3MDI4OTktMmJlNC00MTdlLWE5ZDctZGYyMmJlZDJiZmIx'

Create A Service Key

# ./tg service key_create "U2VydmljZUFjY291bnQ6NDVhZjU2NDgtMDMwMi00NWQ3LTlmMDYtNTk3YzRlYTZjM2E5" "exampleKeyName" "365"
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] Created key 'exampleKeyName: U2VydmljZUFjY291bnRLZXk6bmFLS3VpbHVPV2lkRTlwV1dxS0tmRUVneHM1STV4blF4RW9nMXBNc1Nxcw==' at service 'testService: U2VydmljZUFjY291bnQ6NDVhZjU2NDgtMDMwMi00NWQ3LTlmMDYtNTk3YzRlYTZjM2E5' with token object:
{"version": "1", "network": "exampleNetwork", "service_account_id": "45af5648-0302-45d7-9f06-597c4ea6c3a9", "private_key": "-----BEGIN PRIVATE KEY-----xxxxxxxxxx-----END PRIVATE KEY-----", "key_id": "naKKuiluOWidE9pWWqKKfEEgxs5I5xnQxEog1pMsSqs", "login_path": "/api/v2/headless_node/login"}

Export Command

The tg CLI provides the ability to export account info from the Twingate in varies formats (e.g. resources, devices, groups and users).

# ./tg export --help

  Usage:   tg export
  Version: 0.1.0    

  Description:

    Export from account to various formats

  Options:

    -h, --help                         - Show this help.                                                                 
    -a, --account-name     <string>    - Twingate account name                                                           
    -l, --log-level        [logLevel]  - Log level                (Default: "INFO")                                      
    -f, --format           [value]     - Export format            (Default: "xlsx", Values: "xlsx", "json", "dot", "png",
                                                                  "svg")                                                 
    -o, --output-file      [value]     - Output filename                                                                 
    -n, --remote-networks  [boolean]   - Include Remote Networks                                                         
    -r, --resources        [boolean]   - Include Resources                                                               
    -g, --groups           [boolean]   - Include Groups                                                                  
    -u, --users            [boolean]   - Include Users                                                                   
    -d, --devices          [boolean]   - Include Devices (trust)

To export all info into xlsx format

# ./tg export
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] Export to 'exampleAccount-2022-06-08_17-40-15.xlsx' completed.

To export resource info in JSON format

# ./tg export -r -f json
[INFO]    Using Twingate account: 'exampleAccount'
[SUCCESS] Export to 'exampleAccount-2022-06-08_17-41-27.json' completed.

Note: png and svg format requires the GraphViz package to be installed and available on your path.

Import Command

The import command provides the ability to import all info from a given source (e.g. output generated from the export command)

# ./tg import --help

  Usage:   tg import
  Version: 0.1.0    

  Description:

    Import from excel file to a Twingate account

  Options:

    -h, --help                         - Show this help.                                                                    
    -a, --account-name     <string>    - Twingate account name                                                              
    -l, --log-level        [logLevel]  - Log level                                                         (Default: "INFO")
    -f, --file             <string>    - Path to Excel file to import from                                 (required)       
    -n, --remote-networks  [boolean]   - Include Remote Networks                                                            
    -r, --resources        [boolean]   - Include Resources                                                                  
    -g, --groups           [boolean]   - Include Groups                                                                     
    -d, --devices          [boolean]   - Include Devices (trust)                                                            
    -s, --sync             [boolean]   - Attempt to synchronise entities with the same natural identifier                   
    -y, --assume-yes       [boolean]   - Automatic yes to prompts; assume 'yes' as answer to all prompts

Did this page help you?