Microsoft SQL Server database

Sample application running on a user-managed Azure SQL Database


This application showcases how Radius can use a user-managed Azure SQL Database.

Resource format

resource db 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = {
  name: 'db'
  properties: {
    environment: environment
    recipe: {
      // Name a specific Recipe to use
      name: 'azure-sqldb'
      // Optionally set recipe parameters if needed (specific to the Recipe)
      parameters: {
        server: '*******'

resource db 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = {
  name: 'db'
  properties: {
    environment: environment
    resourceProvisioning: 'manual'
    port: port
    username: username
      password: password
      connectionString: 'Data Source=tcp:${},${port};Initial Catalog=${};User Id=${username};Password=${password};Encrypt=True;TrustServerCertificate=True'


Key Required Description Example
name y The name of your resource. sql
location y The location of your resource. See common values for more information. global
properties y Properties of the resource. See below


Property Required Description Example(s)
application n The ID of the application resource this resource belongs to.
environment y The ID of the environment resource this resource belongs to.
resourceProvisioning n Specifies how the underlying service/resource is provisioned and managed. Options are to provision automatically via ‘recipe’ or provision manually via ‘manual’. Selection determines which set of fields to additionally require. Defaults to ‘recipe’. manual
recipe n Configuration for the Recipe which will deploy the backing infrastructure. See below
resources n An array of IDs of the underlying resources. See below
server n The fully qualified domain name of the SQL server.
database n The name of the SQL database. mydatabase
port n The SQL database port. 1433
username n The username for the SQL database. 'myusername'
secrets n Secrets used when building the resource from values. See below


Property Required Description Example(s)
connectionString n The connection string for the SQL database. Write only. Server=tcp:<database-server-name>,1433;Initial Catalog=<database-name>...
password n The password for the SQL database. Write only. mypassword


Property Required Description Example(s)
name n Specifies the name of the Recipe that should be deployed. If not set, the name defaults to default. name: 'azure-prod'
parameters n An object that contains a list of parameters to set on the Recipe. { size: 'large' }


Property Required Description Example(s)
id n Resource ID of the supporting resource.

Resource provisioning

Provision with a Recipe

Recipes automate infrastructure provisioning using approved templates. When no Recipe configuration is set Radius will use the Recipe registered as the default in the environment for the given resource. Otherwise, a Recipe name and parameters can optionally be set.

Provision manually

If you want to manually manage your infrastructure provisioning outside of Recipes, you can set resourceProvisioning to 'manual' and provide all necessary parameters and values and values that enable Radius to deploy or connect to the desired infrastructure.

Environment variables for connections

Other Radius resources, such as containers, may connect to a Azure SQL resource via connections. When a connection to Azure SQL named, for example, myconnection is declared, Radius injects values into environment variables that are then used to access the connected Azure SQL resource:

Environment variable Example(s)
CONNECTION_MYCONNECTION_CONNECTIONSTRING Server=tcp:<database-server-name>,1433;Initial Catalog=<database-name>...