Skip to content

compose: resource conventions #4746

Description

@weikanglim

!! WIP: Work in progress. This is a draft and does not represent final work.

General Conventions

  1. Type Naming:

    • Resource types are written without hyphens.
    • Example: messaging.eventhubs instead of messaging-eventhubs.
  2. Default Resource Naming (simplified scaffolding scenarios):

    • When adding a resource using azd add, a single resource is created with a default name.
    • Example:
      • event-hubs for messaging.eventhubs.
      • The default name follows a hyphenated format.
  3. Environment Variables:

    • Environment variables follow the format: AZURE_<TYPE>_<PROPERTY>. Unlike the type referenced in 1, underscores may be part of the name for variable naming clarity.
    • With messaging.eventhubs which stems from "Azure Event Hubs", AZURE_EVENT_HUBS_NAME represents the Event Hubs namespace.
    • When there are more than one types, an explicit environment variable mapping must be performed (which azd add can provide a default configuration modification that is used). See compose: explicit mapping #4747

Common Properties

Suffix Description
_HOST Hostname, i.e. myaccount.blob.core.windows.net
_URL URI reference , i.e. redis://
_ENDPOINT HTTP URL , i.e. https://<vault-name>.vault.azure.net/
_PORT Port number, i.e. 333

Resource Definitions

Event Hubs

YAML Definition

resources:
  event-hubs:
    type: messaging.eventhubs
    hubs:
      - events

Binding Environment Variables

Variable Description
AZURE_EVENT_HUBS_NAME Name of the Event Hubs namespace
AZURE_EVENT_HUBS_HOST Hostname of the Event Hubs namespace

Service Bus

YAML Definition

resources:
  service-bus:
    type: messaging.servicebus
    queues:
      - myQueue
    topics:
      - myTopic

Binding Environment Variables

Variable Description
AZURE_SERVICE_BUS_NAME Name of the Service Bus namespace
AZURE_SERVICE_BUS_HOST Hostname of the Service Bus namespace

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/docsDocumentation, design docs

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions