Learn how to provision databases in instances running in an Azure Database
Azure Databases are way of providing relational databases in the cloud. Azure Databases are available for several engines including PostgreSQL, MySQL, MariaDB, SQL Server. At this time, Humanitec provides out of the box support for PostgreSQL, MySQL and MariaDB types with SQL Server coming soon.
You can easily connect Humanitec to an Azure managed database instance. The following paragraph explains how.
- 2.Click on the Show all resources button. An overlay with all available resource categories and types will be presented to you.
- 3.Below Data storages click on the type of database you want to create. This will open an overlay.
- 4.Choose an ID that you will use to identify the resource definition in Humanitec later.
- 5.Select a driver, here - mariadb. Based on your resource driver, a form will be shown with the required driver parameters which will be passed to the driver on every resource creation.
- 6.Fill out the connection parameters that Humanitec will use to create/delete databases in the instance. You can find them in the Database section of the Azure Console.
- Host is called "Server name" in the console.
- Username and Password are the user and password you created when you set up the instance or a user with privileges to create users and databases in the instance that you subsequently created.
- It is vital to ensure the "Append host to user" option is selected.
- 7.Click on Create.
Steps 1 - 3 of creating a resource definition for an AWS managed instance
Steps 4-8 of creating a resource definition for an AWS managed instance
Next, you can configure matching criteria for your database. This enables you to define specific environments or applications to be deployed to this resource.
By clicking on your database in the list of resources, the Matching row will expand and allow you to add or remove matching criteria. Each database resource can be matched to specific Environment Types, App IDs, Environment IDs or Resource IDs. Empty fields are automatically resolved to match all values of the given category.
Based on this Resource Definition, during the deployment on any of the matching environments, an Active Resource will be provisioned if required.
The most common configuration for an Azure Database instance is for it not to be publicly accessible. This is achieved by placing it in a private VNet. The instance will only be accessible to compute running in that VNet or in VNets that are peered to it.
If you do not already have a bastion host set up to administer your instance, you can follow this guide provided by Azure: [Tutorial: Deploy Bastion using manual settings]](https://docs.microsoft.com/en-us/azure/bastion/tutorial-create-host-portal)
Once the bastion host is set up, it will need to be configured to allows connections from Humanitec. This is done by adding the Humanitec public key into the
.ssh/authorized_keysfile on the bastion host.