All skills
microsoft avatar

/azure-eventgrid-py

@e19efc2
by microsoftmicrosoft/skills3.1k stars
351

Azure Event Grid SDK for Python. Use for publishing events, handling CloudEvents, and event-driven architectures. Triggers: "event grid", "EventGridPublisherClient", "CloudEvent", "EventGridEvent", "publish events".

Use this Skill: https://skilld.dev/gh/microsoft/skills/azure-eventgrid-py

This session only. Nothing lands on disk.

referencesnon-hero-scenarios.md

≈399 tokens on demand. Your agent reads this file only when SKILL.md points to it.

azure-eventgrid-py non-hero scenarios

These scenarios are intentionally separate from hero flows in SKILL.md. They cover secondary/advanced patterns typically used after the primary end-to-end path is working.

Async Client

from azure.core.messaging import CloudEvent
from azure.eventgrid.aio import EventGridPublisherClient
from azure.identity.aio import DefaultAzureCredential

async def publish_events():
    async with DefaultAzureCredential() as credential:
        async with EventGridPublisherClient(endpoint, credential) as client:
            event = CloudEvent(
                type="MyApp.Events.Test",
                source="/myapp",
                data={"message": "hello"}
            )
            await client.send(event)

import asyncio
asyncio.run(publish_events())

Namespace Topics (Event Grid Namespaces)

For Event Grid Namespaces (pull delivery):

from azure.core.messaging import CloudEvent
from azure.eventgrid import EventGridPublisherClient
from azure.identity import DefaultAzureCredential

# Namespace endpoint (different from custom topic)
namespace_endpoint = "https://<namespace>.<region>.eventgrid.azure.net"
topic_name = "my-topic"

with DefaultAzureCredential() as credential:
    with EventGridPublisherClient(
        endpoint=namespace_endpoint,
        credential=credential,
        namespace_topic=topic_name,
    ) as client:
        event = CloudEvent(
            type="MyApp.Events.Test",
            source="/myapp",
            data={"message": "hello from namespace"}
        )
        client.send(event)

Source: SKILL.md on GitHub

1 warning15d4 checks · Risk SAFE
  • Gen Agent Trust Hub15d

    This skill provides a secure and standard implementation for interacting with Azure Event Grid using Python. It correctly utilizes managed identity authentication and provides clear guidance on resource management, though users should be mindful of validating data in event payloads.

  • Socket15d

    No alerts

  • Snyk15d

    Risk: LOW · No issues

  • Runlayer7mo

    2/2 files flagged

Signed by skilld at e19efc2. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 3 months ago
Other metadata
metadata
{
  "author": "Microsoft",
  "version": "1.0.0",
  "package": "azure-eventgrid"
}

README badge

README badge for microsoft/skills/azure-eventgrid-py