2. Create Resource Types

Learn how to create Resource Types

Resource Types are the building blocks of Radius and define what developers can deploy. In part two of this tutorial, you will create a PostgreSQL Resource Type.

Create a PostgreSQL Resource Type

To create a PostgreSQL Resource Type in Radius, create the resource type definition file then create the resource type in Radius. The resource type definition for PostgreSQL is in the Radius resource-types-contrib repository where all the Radius Resource Types and Recipes are maintained.

Download postgreSqlDatabases.yaml

The PostgreSQL Resource Type definition includes:

  • namespace: The namespace of the resource type, as a convention Radius.Data is recommended but any name in the form PrimaryName.SecondaryName can be used
  • types: The name of the Resource Type
  • description: The developer documentation on how and when to use the resource, formatted using Markdown
  • apiVersions: The version of the schema defined below
  • schema: The OpenAPI v3 schema which defines the properties of the resource type
    • environment: The Radius environment ID which the resource is deployed to, this property is set by the Radius CLI when the resource is deployed
    • application: The application ID which the resource belongs to
    • size: The size of the PostgreSQL database which must be ‘S’,‘M’, or ‘L’
    • host: The host name used to connect to the database
    • port: The port used to connect to the database
    • username: The username used to connect to the database
    • password: The password used to connect to the database

The host, port, username, and password properties are read-only properties. These properties are set by the Recipe as outputs.

Create the Resource Type using the rad resource-type create command:

rad resource-type create postgreSqlDatabases -f postgreSqlDatabases.yaml

You should see output similar to:

Creating resource type Radius.Data/postgreSqlDatabases
Creating API Version Radius.Data/postgreSqlDatabases@2025-08-01-preview
Creating location Radius.Data/global/

Create a Bicep extension

The rad resource-type create command creates the Resource Type in the Radius control plane. The next step is to create a Bicep extension which will be used by the Radius CLI and VS Code (if you have the Bicep extension for VS Code installed).

  1. Generate the Bicep extension using the rad bicep publish-extension command.

    rad bicep publish-extension -f postgreSqlDatabases.yaml --target radiusResources.tgz
    

    You should see output similar to:

    $ rad bicep publish-extension -f postgreSqlDatabases.yaml --target radiusResources.tgz
    Writing types to /var/folders/w8/89pqzjp52pbg4g256z9cpkww0000gn/T/bicep-extension-2214011863/types.json
    Writing index to /var/folders/w8/89pqzjp52pbg4g256z9cpkww0000gn/T/bicep-extension-2214011863/index.json
    Writing documentation to /var/folders/w8/89pqzjp52pbg4g256z9cpkww0000gn/T/bicep-extension-2214011863/index.md
    Successfully published Bicep extension "postgreSqlDatabases.yaml" to "radiusResources.tgz"
    
  2. Create a file called bicepconfig.json file and add the following contents:

    {
        "extensions": {
            "radius": "br:biceptypes.azurecr.io/radius:latest",
            "radiusResources": "radiusResources.tgz"
        }
    }
    

    Now, any Bicep template with extension radiusResources will reference the radiusResources.tgz file for details about the PostgreSQL resource type.

View the Resource Type in Radius Dashboard

The Radius Dashboard is the GUI for viewing Resource types, Environments and Applications. In order to access it, Kubernetes must expose the Dashboard’s network port. The easiest way to do that is using the kubectl port-forward command:

kubectl port-forward --namespace=radius-system svc/dashboard 7007:80 

Navigate to http://localhost:7007/resource-types/Radius.Data/postgreSqlDatabases to view the documentation of the PostgreSQL resource type. You should see the Dashboard similar to the screenshot below.



In part three of this tutorial, you will create a Recipe to deploy the PostgreSQL Resource Type you just created.

Next Step: Create Recipes