Cloud Storage

The cloud storage integration allows to store chatter and email attachments on the Google Cloud or Microsoft Azure platform instead of the database’s server.

The module can be used to prevent large files from being uploaded to and downloaded from a database’s server or when a database requires more data storage.

Note

  • Files generated by Odoo (e.g., PDF of sales orders) are always stored on the database’s server.

  • A database’s storage limit depends on its hosting solution and the infrastructure in place.

Google Cloud

First, register and sign in to Google Cloud.

Service account

  1. Open the navigation sidebar on the Google Cloud console, then go to IAM & Admin ‣ Service Accounts ‣ Create service account.

  2. Define a Service account name, click Create and continue, then Done.

    screenshot: general-cloud-storage-google-service-account
    menu
    (Google Cloud console) ‣ IAM & Admin ‣ Service Accounts ‣ Create service account
    shows
    The service account creation form with name and ID, and the Done button.
    module
    cloud_storage_google
    notes
    Cloud provider website; blur IDs and secrets.
  3. Note down the service account’s Email as it will be used during the cloud storage bucket configuration.

  4. Click the (Actions) button, then select Manage keys.

    screenshot: general-cloud-storage-google-manage-keys
    menu
    (Google Cloud console) ‣ IAM & Admin ‣ Service Accounts
    shows
    The service account list with the Actions menu open and "Manage keys" highlighted.
    module
    cloud_storage_google
    notes
    Cloud provider website; blur IDs and secrets.
  5. Go to Add key ‣ Create new key, select JSON as the Key type, and click Create. Store the downloaded JSON file containing the key securely. It will be used when configuring Odoo.

    screenshot: general-cloud-storage-google-create-key
    menu
    (Google Cloud console) ‣ Service Accounts ‣ (account) ‣ Keys ‣ Add key ‣ Create new key
    shows
    The "Create private key" dialog with JSON selected.
    module
    cloud_storage_google
    notes
    Cloud provider website; blur IDs and secrets.

Cloud storage bucket

  1. Open the navigation sidebar on the Google Cloud console, then go to Cloud Storage ‣ Buckets ‣ Create.

  2. Enter a bucket name following the bucket naming guidelines and note it down as it will be used when configuring Odoo.

  3. Configure the bucket as desired and click Create when done.

    screenshot: general-cloud-storage-google-create-bucket
    menu
    (Google Cloud console) ‣ Cloud Storage ‣ Buckets ‣ Create
    shows
    The bucket creation form with the bucket name and the Create button.
    module
    cloud_storage_google
    notes
    Cloud provider website; blur IDs and secrets.
  4. Click the (More actions) button, then select Edit access.

    screenshot: general-cloud-storage-google-bucket-actions
    menu
    (Google Cloud console) ‣ Cloud Storage ‣ Buckets
    shows
    The bucket list with the More actions menu open and "Edit access" highlighted.
    module
    cloud_storage_google
    notes
    Cloud provider website; blur IDs and secrets.
  5. Click Add principal and paste the service account’s email in the New principals field.

  6. Select Storage Admin as Role under the Cloud Storage section and click Save.

    screenshot: general-cloud-storage-google-bucket-access
    menu
    (Google Cloud console) ‣ Cloud Storage ‣ (bucket) ‣ Edit access ‣ Add principal
    shows
    The "Grant access" panel with the service account email as new principal and the "Storage Object User" role.
    module
    cloud_storage_google
    notes
    Cloud provider website; blur IDs and secrets.

Odoo configuration

  1. Install the Cloud Storage Google module.

  2. Open the Settings app and select Cloud Storage in the navigation sidebar.

  3. Select Google Cloud Storage as the Cloud Storage Provider for new attachments.

  4. Enter the Google Bucket Name as previously set.

  5. Click Upload your file next to Google Service Account Key and select the downloaded JSON file.

  6. Set a Minimum File Size (bytes) for attachments to be stored on Google Cloud.

screenshot: general-cloud-storage-google-odoo-settings
menu
Settings ‣ General Settings ‣ Cloud Storage
shows
The Cloud Storage section with "Google Cloud Storage" selected as provider, the Google Bucket Name, the uploaded Google Service Account Key, and the Minimum File Size.
module
cloud_storage, cloud_storage_google
notes
English UI, crop to the section; blur the key file name.

Microsoft Azure

First, register and sign it to Microsoft Azure.

App registration

  1. On the Microsoft Azure portal, search for the App registrations service and open it.

  2. Click New registration, enter an application Name, select Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) under Supported account types, and click Register.

    screenshot: general-cloud-storage-azure-app-registration
    menu
    (Azure portal) ‣ App registrations ‣ New registration
    shows
    The app registration form with name and "Supported account types".
    module
    cloud_storage_azure
    notes
    Cloud provider website; blur IDs and secrets.
  3. Note down the Application (client) ID and Directory (tenant) ID as they will be used when configuring Odoo.

  4. Click Add a certificate or secret next to Client credentials, click New client secret, then Add.

    Important

    For security reasons, leave the Expires field on 180 days (6 months) or choose a shorter expiration interval. Before the secret expires, adding a new client secret and updating Odoo’s configuration with the new value is necessary.

  5. Copy the client secret’s Value and store it securely. It will be used when configuring Odoo.

    screenshot: general-cloud-storage-azure-client-secret
    menu
    (Azure portal) ‣ App registrations ‣ (app) ‣ Certificates & secrets ‣ New client secret
    shows
    The "Add a client secret" panel and the resulting secret Value.
    module
    cloud_storage_azure
    notes
    Cloud provider website; blur IDs and secrets.

Storage account

  1. Search for the Storage accounts service, open it, and click Create.

  2. Click Create new below the Resource group field, enter a Name, and click OK.

  3. Enter a unique Storage account name and note it down as it will be used when configuring Odoo.

  4. Configure the storage account as desired, and, when done, click Review + create, then Create.

    screenshot: general-cloud-storage-azure-storage-account
    menu
    (Azure portal) ‣ Storage accounts ‣ Create
    shows
    The storage account creation form (subscription, resource group, name, region).
    module
    cloud_storage_azure
    notes
    Cloud provider website; blur IDs and secrets.

Container

  1. Open your storage account resource, for example by searching for its name, and select Containers under Data storage in the navigation sidebar.

  2. Enter a Name, note it down as it will be used when configuring Odoo, and click Create.

    screenshot: general-cloud-storage-azure-container
    menu
    (Azure portal) ‣ Storage accounts ‣ (account) ‣ Containers ‣ + Container
    shows
    The "New container" panel with the container name.
    module
    cloud_storage_azure
    notes
    Cloud provider website; blur IDs and secrets.

Resource sharing

  1. Select Resource sharing (CORS) under Settings on the storage account’s navigation sidebar.

  2. Create a first CORS blob service rule:

    • Allowed origins: *

    • Allowed methods: GET

    • Allowed headers: Content-Type

    • Exposed headers: Content-Type

    • Max age: 0

  3. Create a second CORS blob service rule and click Save:

    • Allowed origins: *

    • Allowed methods: PUT

    • Allowed headers: content-type,x-ms-blob-type

    • Exposed headers: content-type,x-ms-blob-type

    • Max age: 0

    screenshot: general-cloud-storage-azure-cors
    menu
    (Azure portal) ‣ Storage accounts ‣ (account) ‣ Resource sharing (CORS)
    shows
    The Blob service CORS rules with allowed origins, methods, headers and max age as described in the text.
    module
    cloud_storage_azure
    notes
    Cloud provider website; blur IDs and secrets.

Role assignment

  1. Select Access control (IAM) on the storage account’s navigation sidebar, then click Add and select Add role assignment.

  2. Search for Storage Blobs Data Contributor and click Next.

    Note

    To remove the unnecessary delete permission, create a custom role and search for the custom role’s name instead.

  3. Click Select members, enter the name of the previously registered application, select it, and click Select.

  4. Click Review + assign twice.

    screenshot: general-cloud-storage-azure-role-assignment
    menu
    (Azure portal) ‣ Storage accounts ‣ (account) ‣ Access control (IAM) ‣ Add role assignment
    shows
    The Members tab with the registered app selected, before "Review + assign".
    module
    cloud_storage_azure
    notes
    Cloud provider website; blur IDs and secrets.
Custom role

Note

This step is optional. However, removing the delete permission would prevent anyone managing to access the cloud storage’s credentials from deleting files.

  1. Open your subscription resource, for example by searching for its name, select Access control (IAM) in the navigation sidebar, click Add and select Add custom role.

  2. Select the JSON tab and click Edit. Copy the code below, add your subscription-id under assignableScopes and change the roleName (Custom role) if desired, paste it, and click Save.

{
    "properties": {
        "roleName": "Custom role",
        "description": "",
        "assignableScopes": [
            "/subscriptions/subscription-id"
        ],
        "permissions": [
            {
                "actions": ["Microsoft.Storage/storageAccounts/blobServices/generateUserDelegationKey/action"],
                "notActions": [],
                "dataActions": ["Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read", "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/add/action"],
                "notDataActions": []
            }
        ]
    }
}

Odoo configuration

  1. Install the Cloud Storage Azure module.

  2. Open the Settings app and select Cloud Storage in the navigation sidebar.

  3. Select Azure Cloud Storage as the Cloud Storage Provider for new attachments.

  4. Enter:

  5. Set a Minimum File Size (bytes) for attachments to be stored on Microsoft Azure.