# Azure Patterns

Azure Functions, Cosmos DB modeling, Service Bus patterns, Bicep templates

- Repository: https://github.com/vibeeval/vibecosystem (541 stars)
- Category: DevOps
- License: MIT
- Last updated: 2026-08-08
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add vibeeval/vibecosystem --skill azure-patterns -g -a claude-code -y`
Codex: `npx skills add vibeeval/vibecosystem --skill azure-patterns -g -a codex -y`
Cursor: `npx skills add vibeeval/vibecosystem --skill azure-patterns -g -a cursor -y`
Gemini CLI: `npx skills add vibeeval/vibecosystem --skill azure-patterns -g -a gemini-cli -y`

## Description

Azure Functions, Cosmos DB modeling, Service Bus patterns, Bicep templates

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Azure Patterns

## Azure Functions

### HTTP Trigger (Node.js v4)

```typescript
import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions';

app.http('getOrder', {
  methods: ['GET'],
  authLevel: 'function',
  route: 'orders/{orderId}',
  handler: async (request: HttpRequest, context: InvocationContext): Promise<HttpResponseInit> => {
    const orderId = request.params.orderId;
    context.log(`Processing order: ${orderId}`);

    try {
      const order = await orderService.getById(orderId);
      if (!order) {
        return { status: 404, jsonBody: { error: 'Order not found' } };
      }
      return { status: 200, jsonBody: order };
    } catch (error) {
      context.error('Failed to get order', error);
      return { status: 500, jsonBody: { error: 'Internal server error' } };
    }
  },
});

// Service Bus trigger with retry
app.serviceBusTopic('processOrderEvent', {
  topicName: 'order-events',
  subscriptionName: 'order-processor',
  connection: 'ServiceBusConnection',
  handler: async (message: unknown, context: InvocationContext) => {
    const event = message as OrderEvent;
    context.log(`Processing event: ${event.type} for order ${event.orderId}`);

    await processEvent(event);
  },
});
```

### Durable Functions (Orchestrator)

```typescript
import * as df from 'durable-functions';

df.app.orchestration('orderWorkflow', function* (context) {
  const orderId = context.df.getInput() as string;

  // Step 1: Validate order
  const order = yield context.df.callActivity('validateOrder', orderId);

  // Step 2: Reserve inventory (with retry)
  const retryOptions = new df.RetryOptions(5000, 3); // 5s interval, 3 attempts
  yield context.df.callActivityWithRetry('reserveInventory', retryOptions, order);

  // Step 3: Charge payment
  yield context.df.callActivity('chargePayment', order);

The rest: https://github.com/vibeeval/vibecosystem/blob/HEAD/skills/azure-patterns/SKILL.md
