Fortinet black logo

Azure Administration Guide

Bootstrapping the FortiGate CLI at initial bootup using user data

Copy Link
Copy Doc ID df509335-8675-11eb-9995-00505692583a:281476
Download PDF

Bootstrapping the FortiGate CLI at initial bootup using user data

You can run FortiGate CLI commands at initial bootup by using custom cloud-init.

  1. Download the ARM template and open in a text editor.
  2. Find the variables section and the userData statement as shown. The line number may be different than in the screenshot.
  3. After concat, specify FortiGate CLI commands. If they are run across multiple lines (in the FortiGate CLI, these commands are run by using the Enter key), separate each line with a backslash and n and enclose the whole statement with single quotes.

    The example above is the same as executing the following in the FortiGate CLI:

    config system global

    set timezone 03

    end

  4. Load the file as shown in Invoking a custom ARM template.
  5. After deployment, log into the FortiGate.
  6. Check if the command was successfully run:
    1. In the CLI console, enter diag debug cloudinit show. If the cloud-init was successful, the CLI shows Azure customdata processed successfully. The FortiGate CLI command syntax must be correct.

      If the CLI command fails, you see an error message with diag debug cloudinit show as above. Resolve it and try again.

    2. Check the timezone by running config system global and get commands.

      As expected, the timezone was changed. This means the bootstrapping CLI command worked.

Bootstrapping the FortiGate CLI at initial bootup using user data

You can run FortiGate CLI commands at initial bootup by using custom cloud-init.

  1. Download the ARM template and open in a text editor.
  2. Find the variables section and the userData statement as shown. The line number may be different than in the screenshot.
  3. After concat, specify FortiGate CLI commands. If they are run across multiple lines (in the FortiGate CLI, these commands are run by using the Enter key), separate each line with a backslash and n and enclose the whole statement with single quotes.

    The example above is the same as executing the following in the FortiGate CLI:

    config system global

    set timezone 03

    end

  4. Load the file as shown in Invoking a custom ARM template.
  5. After deployment, log into the FortiGate.
  6. Check if the command was successfully run:
    1. In the CLI console, enter diag debug cloudinit show. If the cloud-init was successful, the CLI shows Azure customdata processed successfully. The FortiGate CLI command syntax must be correct.

      If the CLI command fails, you see an error message with diag debug cloudinit show as above. Resolve it and try again.

    2. Check the timezone by running config system global and get commands.

      As expected, the timezone was changed. This means the bootstrapping CLI command worked.