> For the complete documentation index, see [llms.txt](https://docs.codemash.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.codemash.io/norbix-cloud/code/integrations/google-cloud-functions.md).

# Google Cloud Functions

The following steps show how to connect the **Google Cloud Functions** account to **Norbix**. The steps consist of:

1. Setting up Google Cloud account.
2. Creating a service account.
3. Connecting account into the **Norbix** project.

## Setting up Google Cloud account

If you already have Google Cloud Functions account ready to use, skip this section.

* Go to <https://cloud.google.com/> and login to console with your Google account.
* Select a project from your project menu or create a new one.
* Now open the sidebar menu and navigate to **Cloud Functions**. Here you might see different options if you haven't set up this yet.
  * If you are eligible for a free trial, sign up for free trial.
  * If you are not eligible for a free trial, you will have to add a billing account.

## Creating the first function

If you already have your functions ready, skip this section.

* From the [management console](http://console.cloud.google.com/), open the sidebar menu and select **Cloud Functions**.
* In the opened functions list, press **Create Function**.
* Creating a function. The following steps lead through the function creation process.
  * Set any name, and memory. For **Trigger** use **HTTP**.
  * For **Authentication**, it's recommended to not allow unauthenticated invocations. All of the calls from Norbix will be authenticated.
  * Then select the runtime and edit your code if you want. You will be able to edit it later.
  * In advanced settings, you will see service account selection. Google Cloud should have created a service account for you, so you can use that or you can check [*Adding Google service account*](#adding-google-service-account) on how to add a service account. This setting isn't important for Norbix, so you can leave it how it is.

## Adding Google service account

If you already have your service account set up, skip this section.

* The service account will allow **Norbix** to call **Google Functions**. Firstly navigate to <https://console.developers.google.com/> and select the project. The project should be the same as in your Google Cloud Platform.'
* Navigate to **Credentials** from the sidebar menu.
* Hereunder **Service Account** section you might see existing service account created by Google Cloud. You can use that, in which case, go to the last section. To create a new one press **Manage service accounts** and then **Create Service Account**.
* Set account name and press create. The following steps are NOT optional. You need to grant a few permissions. The minimum required permissions are **Cloud Functions Developer** or **Cloud Functions Admin**.

![Service account permissions](/files/-M7lzNEYVPn26LtmwT7g)

* In the final step, you can create a key to use from Norbix. Press **Create Key** and select key type as JSON. A download will start with a JSON file key.

![Creating service account key](/files/-M7lchpeLdLJZVzxKilo)

## Adding API credentials to Norbix

Once you have a service account to invoke your functions, use it's JSON file key when adding **Google Cloud Functions** account in **Norbix**.

* If you have skipped the previous section, to get the file key, go to google developer console, select your project, and select **Credentials**. Hereunder **Service Accounts** section, select the service account which you want to use for Norbix. Your service account needs at minimum one of these permissions: **Cloud Functions Developer** or **Cloud Functions Admin**. You can check and manage permissions by navigating to **IAM & Admin > IAM** from the sidebar menu. Then in the service account details page select **Create Key**. After that select JSON as key type. You will receive your key.
* Once you have your JSON file with a private key, go to the **Norbix** project dashboard and navigate to Code > Account > Add New > **Google Cloud Functions**.
* Fill the fields. Example with filled details shown below.
  * **Service Account** - contents of your JSON file key.
  * **Region** - all the regions from which you want to get your functions.
  * **Refresh Settings** - in case you are developing your functions and don't want to refresh them manually (to show up in Norbix), you can automatically refresh at certain intervals.
  * **Labels** - function labels. Only those functions that have at least 1 of the label will be imported into Norbix. If no labels are added, then all functions will be imported.

![](/files/-M7lgV6G9TQedxhGiYAu)

* After connecting, your functions will appear in the functions tab. This process might take a few moments to receive all functions from Google services.
