Skip to main content

User & technical access management (RBAC)

Context

In most cases, a database is coupled with another system. Technical accounts are used to perform the authentication between the systems. It's very important to use minimum privileges when you access to the database to limit the impact of a technical account theft.

However, an administrator must need to full access to the database. That's why we provide nominative access to operate the DBaas using Multi-Factor Authentication (MFA).

DBaas Postgresql

DBaas postgresql relies on Azure Database for PostGresSQL Single Server. Authentication and authorization leverage features available on the service and already in GA.

1.1. Authentication for dbaas postgresql

Azure Database for PostGresSQL Single Server integrates with Azure AD with.

The configuration relies on adding a dedicated Azure AD principal as an Active Directory Admin.

Note: While the name might imply a reference to Active Directory Domain service, it does refers to Azure Active Directroy

Illustration 1

1.2. Authorization for dbaas postgresql

The specified service principal is granted postgres admin credentials and can managed authorization inside the postgresql control plane, or add databases. It is used to create 2 additionals role inside the dbaas postgresql instance:

  • A dev role, following the name pattern dbaas-xxx-pg-dev
  • A devops role, following the name pattern dbaas-xxx-pg-devops

the xxx string refers to the tenancy and instance of the dbaas postgresql

Illustration 2

Apart from this Azure AD Admin, no other access is granted on the Azure control plane of the dbaas postgresql instance

DBaas CosmoDB

DBaas nosql relies on Cosmos DB and specifically Cosmos DB with MongoDB API.

Authentication and authorization are considered from both Azure Control plane and DBaas Data plane contrary to the dbaas postgresql for which the end user only has to consider the dbaas data plane.

2.1. Authentication for dbaas nosql

Because it is largely integrated to the Azure portal, authentication to dbaas nosql relies on Azure Active Directory.

To gain access to the dbaas nosql instance in Azure, users are granted 2 roles:

  • Built-in role Cosmos DB Account Reader Role:

{
"assignableScopes": [
"/"
],
"description": "Can read Azure Cosmos DB Accounts data",
"id": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/fbdf93bf-df7d-467e-a4d2-9458aa1360c8",
"name": "fbdf93bf-df7d-467e-a4d2-9458aa1360c8",
"permissions": [
{
"actions": [
"Microsoft.Authorization/*/read",
"Microsoft.DocumentDB/*/read",
"Microsoft.DocumentDB/databaseAccounts/readonlykeys/action",
"Microsoft.Insights/MetricDefinitions/read",
"Microsoft.Insights/Metrics/read",
"Microsoft.Resources/subscriptions/resourceGroups/read",
"Microsoft.Support/*"
],
"notActions": [],
"dataActions": [],
"notDataActions": []
}
],
"roleName": "Cosmos DB Account Reader Role",
"roleType": "BuiltInRole",
"type": "Microsoft.Authorization/roleDefinitions"
}


This role grant a reader access to the dbaas nosql account and also allow to get the read-only key

  • Custom role Dbaas-Nosql-GetKeys:

{
"id": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/{customroleguid}",
"properties": {
"roleName": "Dbaas-Nosql-GetKeys",
"description": "A custom role that, added with built'in role Cosmos DB Account Reader Role allows to get the write keys of cosmosdb account and define a connection on a compatible client",
"assignableScopes": [
"/subscriptions/{subscriptionId}"
],
"permissions": [
{
"actions": [
"Microsoft.DocumentDB/databaseAccounts/listKeys/action"
],
"notActions": [],
"dataActions": [],
"notDataActions": []
}
]
}
}

This role add the capability to get the write key

2.2. Authorization for dbaas nosql

As introduced in the previous part, authorization in dbaas nosql is relying on access key.

When granted Cosmos DB Account Reader Role, a user can get the read-only access key and thus read data in dbaas nosql.

Illustration 3

Viewing read key for a dbaas nosql mongodb api

Adding the Custom role Dbaas-Nosql-GetKeys, a user can get access to the write key:

Illustration 5

Viewing read-write key for a dbaas nosql mongodb api

Illustration 6

Note: With those roles added, it is not possible to use the data explorer in the portal to write in the databases. Only PUT operations through the API with the read-write key can.

Granting read and write access to the embedded data explorer requires additional custom roles.

2.3 Write access with data explorer for dbass nosql mongodb api

The following custom role is require for write access on dbaas nosql with mongodb api:


{
"id": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/{customroleguid}",
"properties": {
"roleName": "Dbaas-nosql-MongoDBWrite",
"description": "A custom role that, added with built'in role Cosmos DB Account Reader Role allows to interact with Data in cosmos db account with mongodb api in the Data explorer",
"assignableScopes": [
"/subscriptions/{subscriptionId}"
],
"permissions": [
{
"actions": [
"Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/*"
],
"notActions": [],
"dataActions": [],
"notDataActions": []
}
]
}
}

In total, it grants the following 28 authorizations:

API Action typePermissionsdescriptionAPI path
WriteWrite MongoDB databaseCreate a MongoDB databaseMicrosoft.DocumentDB/databaseAccounts/mongodbDatabases/write
ReadRead MongoDB database(s)Read a MongoDB database or list all the MongoDB databases.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/read
DeleteDelete MongoDB databaseDelete a MongoDB database.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/delete
WriteWrite MongoDB collectionCreate or update a MongoDB collection.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/write
ReadRead MongoDB collection(s)Read a MongoDB collection or list all the MongoDB collections.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/read
DeleteDelete MongoDB collectionDelete a MongoDB collection.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/delete
OtherMerge the physical partitions of a MongoDB collectionMerge the physical partitions of a MongoDB collectionMicrosoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/partitionMerge/action
ReadRead operation resultsRead status of the asynchronous operation.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/operationResults/read
ReadRead operation resultsRead status of the asynchronous operation.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/partitionMerge/operationResults/read
WriteWrite MongoDB collection throughputUpdate a MongoDB collection throughput.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/write
ReadRead MongoDB collection throughputRead a MongoDB collection throughput.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/read
OtherMigrate MongoDB collection offer to autoscaleMigrate MongoDB collection offer to autoscale.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/migrateToAutoscale/action
OtherMigrate MongoDB collection offer to to manual throughputMigrate MongoDB collection offer to to manual throughput.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/migrateToManualThroughput/action
OtherRedistribute throughput for the specified physical partitions of the MongoDB collection.Redistribute throughput for the specified physical partitions of the MongoDB collection.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/redistributeThroughput/action
OtherRetrieve throughput for the specified physical partitions of the MongoDB collection.Retrieve throughput for the specified physical partitions of the MongoDB collection.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/retrieveThroughputDistribution/action
ReadRead operation resultsRead status of the asynchronous operation.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/operationResults/read
ReadRead operation resultsRead status of the asynchronous operation.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/migrateToAutoscale/operationResults/read
ReadRead operation resultsRead status of the asynchronous operation.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings/migrateToManualscale/operationResults/read
ReadRead operation resultsRead status of the asynchronous operation.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/operationResults/read
WriteWrite MongoDB database throughputUpdate a MongoDB database throughput.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/write
ReadRead MongoDB database throughputRead a MongoDB database throughput.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/read
OtherMigrate MongoDB database offer to autoscaleMigrate MongoDB database offer to autoscale.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/migrateToAutoscale/action
OtherMigrate MongoDB database offer to to manual throughputMigrate MongoDB database offer to to manual throughput.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/migrateToManualThroughput/action
OtherRedistribute throughput for the specified physical partitions of the MongoDB database.Redistribute throughput for the specified physical partitions of the MongoDB databaseMicrosoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/redistributeThroughput/action
OtherRetrieve throughput for the specified physical partitions of the MongoDB database.Retrieve throughput for the specified physical partitions of the MongoDB database.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/retrieveThroughput/action
ReadRead operation resultsRead status of the asynchronous operation.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/migrateToAutoscale/operationResults/read
ReadRead operation resultsRead status of the asynchronous operation.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/migrateToManualThroughput/operationResults/read
ReadRead operation resultsRead status of the asynchronous operation.Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings/operationResults/read

3. Summary of granted access per role

The below table summarize which access is granted with which role

Role definitionAccess granted
Built-in role Cosmos DB Account Reader RoleRead access on Cosmos DB account. Can retrieve read-only key
Custom role Dbaas-Nosql-GetKeysIn addition to Cosmos DB Account Reader Role, grant acces to write keys only
Custom role Dbaas-nosql-MongoDBWriteIn addition to Cosmos DB Account Reader Role and Custom role Dbaas-Nosql-GetKeys, grant acces to write keys and to write operations from embedded Data explorer

DBaas Opensearch

Multi tenancy

Opensearch-dashoard implements the concept of multi tenancy to make the consultation of data and dashboards confidential.

Tenant:

Tenants in opensearch-dashboard are spaces for saving index patterns, visualizations, dashboards, and other opensearch-dashboard objects. By default, all opensearch-dashboard users have access to two tenants: Private and Global. The global tenant is shared between every opensearch-dashboard user. The private tenant is exclusive to each user and can’t be shared.

Tenants are useful for safely sharing your work with other opensearch-dashboard users. You can control which roles have access to a tenant and whether those roles have read or write access.

You might use the private tenant for exploratory work, create detailed visualizations with your team in an analysts tenant, and maintain a summary dashboard for corporate leadership in an executive tenant.

RBAC

Use cases:

  • Provide dedicated opensearch-dashboard accesses to different team in the same entity or company
  • Isolate the access between several elasticsearch indices

Warning::: we do not recommend using this multi tenancy feature to isolate high confidential information. Depending on the context, we recommend to use dedicated clusters to have a strong logical segregation between the data of multiple clusters. :::

What to do ?

By default, DBaas opensearch is provided with a single tenant (with the name of your instance). All the provided users have access to this default tenant.

To set up the multi tenancy feature, you first need to define the following information:

Tenant NameIndex pattern to queryList of users
tenantAtenanta-*user1, user2 etc...

Note 1: please be careful on the "index pattern to query" section. If there is an overlap, 2 tenants could have access to the same data, that could lead to a data leakage. Note 2: You should think first of what you want, second adapt the index where the data is stored and finally, define the tenant.

Once done, raise a ticket to support-platform@thalesdigital.io asking for an escalation to tdp-esaas, with the owner of the service (on your business line side) with the following data:

  • name of your cluster
  • tenancy definition (table below)

Give access to DBaas opensearch

Look at the dedicated doc opensearch-rbac