Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Prepare applications for Azure deployment by generating infrastructure code, Dockerfiles, and config files.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/services/event-grid/bicep.md
1# Event Grid - Bicep Patterns23## Custom Topic45```bicep6resource eventGridTopic 'Microsoft.EventGrid/topics@2023-12-15-preview' = {7name: '${resourcePrefix}-egt-${uniqueHash}'8location: location9properties: {10inputSchema: 'EventGridSchema'11publicNetworkAccess: 'Enabled'12}13}14```1516## System Topic (Azure Resource Events)1718```bicep19resource storageSystemTopic 'Microsoft.EventGrid/systemTopics@2023-12-15-preview' = {20name: '${resourcePrefix}-storage-topic'21location: location22properties: {23source: storageAccount.id24topicType: 'Microsoft.Storage.StorageAccounts'25}26}27```2829## Event Domain3031```bicep32resource eventDomain 'Microsoft.EventGrid/domains@2023-12-15-preview' = {33name: '${resourcePrefix}-domain'34location: location35properties: {36inputSchema: 'EventGridSchema'37}38}39```4041## Publishing Events4243### Node.js4445```javascript46const { EventGridPublisherClient, AzureKeyCredential } = require("@azure/eventgrid");4748const client = new EventGridPublisherClient(49process.env.EVENTGRID_TOPIC_ENDPOINT,50"EventGrid",51new AzureKeyCredential(process.env.EVENTGRID_TOPIC_KEY)52);5354await client.send([{55eventType: "Order.Created",56subject: "/orders/12345",57dataVersion: "1.0",58data: { orderId: "12345" }59}]);60```6162### Python6364```python65from azure.eventgrid import EventGridPublisherClient, EventGridEvent66from azure.core.credentials import AzureKeyCredential6768client = EventGridPublisherClient(69os.environ["EVENTGRID_TOPIC_ENDPOINT"],70AzureKeyCredential(os.environ["EVENTGRID_TOPIC_KEY"])71)7273client.send([EventGridEvent(74event_type="Order.Created",75subject="/orders/12345",76data={"orderId": "12345"},77data_version="1.0"78)])79```80