Reference: Recipe context object schema

Learn how to use the Recipe context object in your Recipe templates

The context object is automatically injected to Bicep templates when a Recipe is run. It contains information about the runtime, environment, application, and resource from which the Recipe was run. This enables you to author templates that can be used as Recipes. For more information visit the Recipe authoring how-to guide.

Usage


@description('Radius-provided object containing information about the resource calling the Recipe')
param context object

var resourceName = context.resource.name
var namespace = context.runtime.kubernetes.namespace
KeyTypeDescription
resourceobjectRepresents the resource metadata of the deploying recipe resource.
applicationobjectRepresents application metadata.
environmentobjectRepresents environment metadata.
runtimeobjectAn object containing information on the underlying runtime.
azureobjectRepresents Azure provider scope metadata.
awsobjectRepresents AWS provider scope metadata.

resource

KeyTypeDescriptionExample
namestringThe name of the resource calling this Recipemyredis
idstringThe ID of the resource calling this Recipe/planes/radius/resourceGroups/myrg/Applications.Link/redisCaches/myredis
typestringThe type of the resource calling this recipeApplications.Link/redisCaches
propertiesobjectThe properties of the resource calling this recipe{ "cpuCores": 4, "memory": "8GB" }

application

KeyTypeDescriptionExample
namestringThe name of the applicationmyapp
idstringThe resource ID of the application/planes/radius/resourceGroups/myrg/Applications.Core/applications/myapp

environment

KeyTypeDescriptionExample
namestringThe name of the environmentmyenv
idstringThe resource ID of the environment/planes/radius/resourceGroups/myrg/Applications.Core/environments/myenv

runtime

KeyTypeDescription
kubernetesobjectAn object with details of the underlying Kubernetes cluster, if configured on the environment

kubernetes

KeyTypeDescription
namespacestringSet to the application’s namespace when the resource is application-scoped, and set to the environment’s namespace when the resource is environment scoped.
environmentNamespacestringSet to the environment’s namespace.

azure

KeyTypeDescription
resourceGroupobjectAn object with details of the Azure Resource Group provider information, if configured on the environment
subscriptionobjectAn object with details of the Azure Subscription provider information, if configured on the environment

resourceGroup

KeyTypeDescription
namestringThe resource group name.
idstringRepresents fully qualified resource group id.

subscription

KeyTypeDescription
subscriptionIdstringThe GUID of the subscription.
idstringRepresents fully qualified subscription id.

aws

KeyTypeDescription
regionstringRepresents the region where AWS resources are deployed.
accountstringRepresents the account id of the AWS account.