Skip to content

Repository files navigation

openazure

🔎 Example output

Real, reproducible output from the tool — runs offline:

$ openazure-emit --help
usage: openazure-emit [-h]
                      --to {stix,taxii,misp,sigma,splunk,elastic,slack,discord,webhook,brief,findings}
                      [--url URL] [--token TOKEN] [--dry-run]
                      [input]

forward openazure JSON findings to a platform via cognis-connect

positional arguments:
  input                 findings JSON file (default: stdin)

options:
  -h, --help            show this help message and exit
  --to {stix,taxii,misp,sigma,splunk,elastic,slack,discord,webhook,brief,findings}
  --url URL
  --token TOKEN
  --dry-run

Blocks above are real openazure output — reproduce them from a clone.

Sample result format (illustrative values — run on your own data for real findings):

{
  "Findings": [
    {
      "id": "1234567890",
      "title": "Suspicious Network Traffic",
      "description": "Network traffic detected from unknown IP address",
      "severity": "medium",
      "created_at": "2023-02-15T14:30:00Z"
    },
    {
      "id": "2345678901",
      "title": "Malware Detected",
      "description": "Malware identified on system",
      "severity": "high",
      "created_at": "2023-02-16T10:45:00Z"
    }
  ]
}

Usage — step by step

openazure is a local open-source emulator of Azure primitives (blob / queue), with thin HTTP client subcommands for quick manual checks.

  1. Install (editable from a clone, or from the wheel):
    pip install -e .
    # provides the `openazure` console script
  2. Start the local server (defaults to 127.0.0.1:10000; it persists to ./openazure-data unless you pass --in-memory):
    openazure serve --data-dir ./openazure-data
    # or ephemeral:
    openazure --port 10000 serve --in-memory
  3. Exercise the data plane with the built-in HTTP client subcommands (these talk to a running serve instance — --host/--port are top-level flags):
    openazure --port 10000 blob ls my-container
    openazure --port 10000 queue put jobs '{"task":"resize"}'
  4. Read / use the output. The client subcommands print the server's JSON response and exit non-zero on HTTP errors (status ≥ 400), so they double as simple health checks. openazure version prints the version.
  5. Use it in CI. Launch the server in the background, run your Azure-SDK tests against the local endpoint, then tear it down:
    openazure serve --in-memory &
    # ... run tests pointed at http://127.0.0.1:10000 ...
    openazure --port 10000 queue put smoke '{"ping":1}'

What is this?

openazure is a small, self-contained program you run on your own machine that imitates the core building blocks of Microsoft Azure's storage and serverless stack. Instead of creating a real cloud account, paying for usage, and needing an internet connection, you start openazure locally and talk to it exactly like you would talk to the real services.

It gives a developer fourteen things:

  • Blob Storage — store and fetch files ("blobs") grouped into containers; block-blob staging and commit, metadata, access tiers, server-side copy, SAS token stubs, and container lease stubs.
  • Table Storage — store JSON records keyed by a PartitionKey + RowKey; insert/upsert/merge/replace/query including OData-lite $filter/$top/$select and atomic batch transactions.
  • Queue Storage — push messages onto a queue and pull them off later, with a visibility timeout so a message you are working on isn't handed to anyone else until you finish (or time out); update message visibility/body in place.
  • Functions runner — register small Python handlers that run on an HTTP request, when a queue message arrives, on a timer, when a blob is written, or when a Service Bus message arrives — the way Azure Functions triggers work.
  • Cosmos DB — databases, containers with a partition key, and items; full CRUD plus a SQL-subset query engine (SELECT/WHERE/ORDER BY/ OFFSET … LIMIT).
  • File Shares — shares, directories (hierarchical), and files; upload, download, metadata, server-side copy, and directory listing.
  • Service Bus — queues and topics/subscriptions; send, receive (peek-lock), complete, abandon, dead-letter; SQL-filter rules on subscriptions; session-enabled queues with session-scoped receive; dead-letter sub-queue and auto-dead-letter on max delivery count exceeded.
  • Event Hubs — event hubs with configurable partitions; consumer groups ($Default created automatically); send single events or batches (by partition key or explicit partition); receive events per-partition per-consumer-group with checkpoint tracking.
  • Event Grid — custom topics with EventGridSchema or CloudEvents 1.0; event subscriptions with event-type, subject prefix/suffix, and property equality filters; publish events with fan-out to matching subscriptions; stored-event inspection for testing.
  • Key Vault — secrets (create/get/list/delete/recover/purge, soft-delete, full version history), keys (RSA/EC/oct; encrypt/decrypt/wrap/unwrap with a deterministic test cipher), and certificate metadata (create/get/list/ delete/recover/purge); soft-delete lifecycle for all three object types.
  • Managed Identity / Azure AD-lite — register named identities (user- assigned MI placeholders); issue signed HMAC-SHA256 bearer tokens (JWT-like three-part format); validate and revoke tokens; role assignment to identities with scope.
  • App Configuration — key-values with labels, content types, tags, and ETags; optimistic concurrency via If-Match; lock/unlock (read-only); full revision history per key+label; feature flags (create/toggle/list with client-filter conditions); named snapshots capturing point-in-time state.
  • Azure Monitor — metric ingestion (single and batch) with namespace, dimensions, and custom timestamp; metric queries with avg/min/max/sum/count aggregation over configurable time buckets; log workspaces with multi-table log ingestion; SQL-subset log queries (SELECT/WHERE/ORDER BY/LIMIT); alert rules with threshold evaluation over a sliding time window.
  • Notification Hubs — hub management; device registration and installation APIs (create/update/delete/list with tag filters); tag-expression targeted send (&&, ||, !, parentheses); platform-scoped send; all sent notifications captured for test inspection.

Who is it for? Developers who want to build and test code that uses Azure storage/functions without touching the cloud — for fast unit tests, offline work, CI pipelines, demos, and learning. It is in the same spirit as LocalStack (AWS), MinIO (S3), and the Firebase Emulator Suite.

Everything runs in a single local HTTP server, persists to a local SQLite file (or to pure memory for tests), and is written entirely against the Python standard library — no third-party runtime dependencies.

Disclaimer

openazure is an independent, open reimplementation intended for local development and testing only. It is NOT affiliated with, endorsed by, or sponsored by Microsoft Corporation. "Azure" and related names are used only nominatively, to describe which API behaviors openazure aims to be compatible with. openazure implements a compatible subset of those services and is not intended for production use.

Architecture

openazure/
├── openazure/
│   ├── __init__.py           # package exports + version
│   ├── store.py              # shared sqlite3 backend (disk or :memory:)
│   ├── errors.py             # typed errors -> HTTP status + Azure-style codes
│   ├── blob.py               # BlobService          (containers / blobs / blocks / metadata)
│   ├── table.py              # TableService         (entities, OData-lite query, batch)
│   ├── queue.py              # QueueService         (visibility-timeout messages, update)
│   ├── functions.py          # FunctionRunner       (http/queue/timer/blob/servicebus triggers)
│   ├── cosmos.py             # CosmosService        (databases / containers / items / SQL)
│   ├── fileshare.py          # FileShareService     (shares / directories / files)
│   ├── servicebus.py         # ServiceBusService    (queues, topics/subs, SQL-filter, sessions)
│   ├── eventhubs.py          # EventHubsService     (hubs, partitions, consumer groups, events)
│   ├── eventgrid.py          # EventGridService     (topics, subscriptions, publish/filter)
│   ├── keyvault.py           # KeyVaultService      (secrets, keys, certificates, soft-delete)
│   ├── managedidentity.py    # ManagedIdentityService (identities, tokens, roles)
│   ├── appconfig.py          # AppConfigService     (key-values, labels, feature flags, snapshots)
│   ├── monitor.py            # MonitorService       (metrics, log workspaces, alert rules)
│   ├── notificationhubs.py   # NotificationHubsService (registrations, installations, send)
│   ├── server.py             # one ThreadingHTTPServer exposing all services
│   ├── cli.py                # `openazure` console entry point
│   └── __main__.py           # `python -m openazure`
└── tests/                    # end-to-end pytest suite

All services share a single Store (one SQLite connection), so a single in-memory instance is consistent across services within one process. The HTTP server (server.py) maps clean path prefixes onto the service classes; the service classes can also be imported and called directly with no server.

Services

Service Module Class Primitives Local path prefix
Blob blob.py BlobService containers; blobs (bytes, ETag, Content-MD5); block-blob stage/commit; metadata; tier (Hot/Cool/Archive); server-side copy; SAS token stub; container lease stub /blob
Table table.py TableService tables; entities keyed by PartitionKey+RowKey; insert/upsert/merge/replace/query; OData-lite $filter/$top/$select; atomic batch transactions /table
Queue queue.py QueueService queues; messages with visibility timeout + pop receipts; update message (visibility/body); peek; clear /queue
Functions functions.py FunctionRunner HTTP-trigger; queue-trigger; timer-trigger; blob-trigger; Service Bus trigger — Python handlers with at-least-once delivery /functions
Cosmos DB cosmos.py CosmosService databases, containers (partition key), items (CRUD, upsert); SQL-subset query (SELECT/WHERE/ORDER BY/OFFSET LIMIT) /cosmos
File Shares fileshare.py FileShareService shares, directories (hierarchical), files (upload/download/copy/metadata/delete), directory listing /files
Service Bus servicebus.py ServiceBusService queues + topics/subscriptions; send/receive (peek-lock)/complete/abandon/dead-letter; SQL-filter rules; session-enabled queues; dead-letter sub-queue; auto-dead-letter on max delivery count /servicebus
Event Hubs eventhubs.py EventHubsService event hubs; configurable partitions; consumer groups ($Default auto-created); send events (single/batch, by partition key or explicit); receive with per-consumer-group checkpoint tracking /eventhubs
Event Grid eventgrid.py EventGridService custom topics (EventGridSchema + CloudEvents 1.0); event subscriptions with event-type, subject prefix/suffix, and property equality filters; publish with fan-out to matching subscriptions; stored-event inspection /eventgrid
Key Vault keyvault.py KeyVaultService secrets (set/get/list/delete/recover/purge, soft-delete, full version history); keys (RSA/EC/oct; encrypt/decrypt/wrap/unwrap); certificate metadata (create/get/list/delete/recover/purge); soft-delete lifecycle for all three types /keyvault
Managed Identity managedidentity.py ManagedIdentityService identity register/list/get/delete; HMAC-SHA256 bearer token issue/validate/revoke; role assignment with scope /identity
App Configuration appconfig.py AppConfigService key-values with labels/tags/content-type/ETags; optimistic concurrency; lock/unlock; revision history; feature flags (create/toggle/list with client-filter conditions); named point-in-time snapshots /appconfig
Azure Monitor monitor.py MonitorService metric ingestion (single/batch, dimensions, custom timestamp); metric queries (avg/min/max/sum/count, time buckets, dimension filter); log workspaces; log ingestion; SQL-subset log queries; alert rules with threshold evaluation /monitor
Notification Hubs notificationhubs.py NotificationHubsService hub CRUD; device registrations (create/update/delete/list/tag-filter); installation upsert API; tag-expression targeted send (&&/||/!/parens); platform-scoped send; all sent notifications captured for inspection /notificationhubs

Quickstart

Start the local server (in-memory, nothing persisted):

openazure serve --in-memory
# openazure listening on http://127.0.0.1:10000 (data_dir=memory)

Or persist to a local directory:

openazure serve --data-dir ./openazure-data --port 10000

Talk to it with curl:

# Blob: create a container, upload a file, download it
curl -X PUT  http://127.0.0.1:10000/blob/photos
curl -X PUT  --data-binary @cat.jpg http://127.0.0.1:10000/blob/photos/cat.jpg
curl         http://127.0.0.1:10000/blob/photos/cat.jpg --output out.jpg

# Block blob: stage blocks then commit
curl -X POST --data-binary @part1.bin \
     'http://127.0.0.1:10000/blob/photos/big.bin?comp=block&blockid=b1'
curl -X PUT  -d '{"blocks":["b1"],"content_type":"application/octet-stream"}' \
     'http://127.0.0.1:10000/blob/photos/big.bin?comp=blocklist'

# Table: insert and read an entity; OData filter
curl -X PUT  http://127.0.0.1:10000/table/People
curl -X POST http://127.0.0.1:10000/table/People \
     -d '{"PartitionKey":"us","RowKey":"alice","age":30}'
curl 'http://127.0.0.1:10000/table/People?pk=us&rk=alice'
curl 'http://127.0.0.1:10000/table/People?pk=us&$filter=age%20gt%2025&$top=5'

# Table batch transaction
curl -X POST 'http://127.0.0.1:10000/table/People?comp=batch' \
     -d '[{"op":"insert","entity":{"PartitionKey":"eu","RowKey":"bob","age":25}}]'

# Queue: create, enqueue, dequeue
curl -X PUT  http://127.0.0.1:10000/queue/jobs
curl -X POST http://127.0.0.1:10000/queue/jobs/messages -d '{"body":"hello"}'
curl 'http://127.0.0.1:10000/queue/jobs/messages?num=1&vt=30'

# Cosmos DB: create database, container, item, query
curl -X PUT  http://127.0.0.1:10000/cosmos/mydb
curl -X PUT  http://127.0.0.1:10000/cosmos/mydb/users \
     -d '{"partitionKey":"/country"}'
curl -X POST http://127.0.0.1:10000/cosmos/mydb/users/items \
     -d '{"id":"u1","country":"us","name":"Alice"}'
curl -X POST http://127.0.0.1:10000/cosmos/mydb/users/query \
     -d '{"query":"SELECT * FROM c WHERE c.country = '\''us'\''"}'

# File Shares: create share, directory, upload and download a file
curl -X PUT  http://127.0.0.1:10000/files/myshare -d '{"quota_gb":100}'
curl -X PUT  'http://127.0.0.1:10000/files/myshare/docs?comp=dir' -d '{}'
curl -X PUT  --data-binary @readme.txt \
     http://127.0.0.1:10000/files/myshare/docs/readme.txt
curl         http://127.0.0.1:10000/files/myshare/docs/readme.txt
curl         'http://127.0.0.1:10000/files/myshare/docs?comp=dir'

Or use the classes directly in Python (no server needed):

from openazure.store import Store
from openazure.blob import BlobService

store = Store(in_memory=True)
blob = BlobService(store)
blob.create_container("docs")
blob.put_blob("docs", "hello.txt", b"hi there", "text/plain")
print(blob.get_blob("docs", "hello.txt")["content"])  # b'hi there'

Cosmos DB:

from openazure.store import Store
from openazure.cosmos import CosmosService

store = Store(in_memory=True)
cosmos = CosmosService(store)
cosmos.create_database("mydb")
cosmos.create_container("mydb", "items", "/category")
cosmos.create_item("mydb", "items", {"id": "1", "category": "A", "val": 42})
results = cosmos.query_items("mydb", "items",
                             "SELECT * FROM c WHERE c.category = 'A'")
print(results[0]["val"])  # 42

Register an Azure-Functions-style handler:

from openazure.server import OpenAzure

app = OpenAzure(in_memory=True)

@app.functions.http_function("greet")
def greet(req):
    name = req["params"].get("name", "world")
    return {"status": 200, "body": f"hello {name}"}

print(app.functions.invoke_http("greet", {"params": {"name": "azure"}}))

Domains

Primary domain: Cloud & DevTools · JTF MERIDIAN division: ATHENA-PRIME · COGNI-2

Topics: cognis devtools cloud developer-tools cloud-emulator

Part of the Cognis Neural Suite — 300+ source-available tools organized across 12 domains under the JTF MERIDIAN command structure. See the suite on GitHub and jtf-meridian for how the pieces fit together.

Install

openazure is source-available (COCL 1.0) and is not published to PyPI. Install it directly from the Git repository.

One-line installers (clone-free, from this repo):

# macOS / Linux
curl -fsSL https://github.com/ghraw/cognis-digital/openazure/main/install.sh | bash
# Windows PowerShell
irm https://github.com/ghraw/cognis-digital/openazure/main/install.ps1 | iex

pipx (isolated, recommended for a CLI):

pipx install "git+https://github.com/cognis-digital/openazure.git"

uv:

uv tool install "git+https://github.com/cognis-digital/openazure.git"
# or, into a project:
uv pip install "git+https://github.com/cognis-digital/openazure.git"

pip (git+https):

python -m pip install "git+https://github.com/cognis-digital/openazure.git"

From source (for development / running the tests):

git clone https://github.com/cognis-digital/openazure.git
cd openazure
python -m pip install -e ".[dev]"
python -m pytest -q

After install you get an openazure console command (and python -m openazure).

Requirements: Python 3.10+ and the standard library only. No third-party runtime dependencies. Works on Linux, macOS, and Windows.

Topics / Domains

azure-emulator · local-development · cloud-emulation · blob-storage · table-storage · queue-storage · serverless-functions · cosmos-db · file-shares · testing · offline-development · developer-tools

Verification

The test suite is a real end-to-end pytest suite under tests/ that exercises every service both directly (calling the service classes) and over the live HTTP server (started in-process on an OS-assigned port and driven with urllib). On the development machine:

$ python -m pytest -q
490 passed

490 tests pass (tests/test_blob.py, tests/test_blob_extended.py, tests/test_table.py, tests/test_table_extended.py, tests/test_queue.py, tests/test_queue_extended.py, tests/test_functions.py, tests/test_functions_extended.py, tests/test_server.py, tests/test_server_extended.py, tests/test_cosmos.py, tests/test_fileshare.py, tests/test_servicebus.py, tests/test_eventhubs.py, tests/test_eventgrid.py, tests/test_messaging_server.py, tests/test_keyvault.py, tests/test_managedidentity.py, tests/test_appconfig.py, tests/test_monitor.py, tests/test_notificationhubs.py, tests/test_identity_security_server.py), covering:

  • Blob round-trips, Content-MD5, block-blob staging and commit, metadata, access tiers (Hot/Cool/Archive), server-side copy, SAS token stubs, container lease acquire/release.
  • Table insert/upsert/merge/replace/query, OData-lite $filter (eq/ne/gt/lt/ ge/le/and, string/number/bool values), $top, $select, atomic batch transactions with rollback on failure.
  • Queue visibility-timeout redelivery, pop-receipt deletion, and update-message (change visibility timeout or body while a message is in flight).
  • Function HTTP, queue, timer, blob, and Service Bus triggers (including at-least-once behavior on handler failure).
  • Cosmos DB: databases, containers, items (CRUD + upsert), partition key scoping, SQL-subset queries (SELECT/WHERE/ORDER BY/OFFSET LIMIT).
  • File Shares: shares, directories (hierarchical, empty-check enforcement), files (upload/download/copy/metadata/delete), directory listing.
  • Service Bus: queue and topic/subscription CRUD; send/receive (peek-lock); complete/abandon/dead-letter; SQL-filter rules (comparison operators, AND/OR/NOT, string/number/boolean literals, user-property lookup); session-enabled queues; dead-letter sub-queue; auto-dead-letter on max-delivery-count exceeded.
  • Event Hubs: hub + partition + consumer group CRUD; send single events and batches (by partition key or explicit partition); receive with per-consumer- group checkpoint tracking; multiple independent consumer groups.
  • Event Grid: topic + subscription CRUD; publish (EventGridSchema and CloudEvents 1.0); event-type, subject-prefix, subject-suffix, and property equality filters; fan-out to matching subscriptions; stored-event inspection.
  • Key Vault: secrets (set/get/list/delete/recover/purge with soft-delete, full version history); keys (RSA/EC/oct; encrypt/decrypt/wrap/unwrap round-trips); certificate metadata (create/get/list/delete/recover/purge); all soft-delete lifecycle transitions.
  • Managed Identity: identity register/list/get/delete; HMAC-SHA256 bearer token issue and validate; token expiry and revocation; role assignment; multiple independent identities on the same store.
  • App Configuration: key-values with labels and tags; update/delete; optimistic concurrency lock/unlock; full revision history; feature flags (create/toggle/ list with client-filter conditions); point-in-time named snapshots.
  • Azure Monitor: metric ingestion (single and batch, with dimensions and custom timestamps); metric aggregation queries (avg/min/max/sum/count, time buckets, dimension filter, time range); log workspace CRUD; log ingestion; SQL-subset log queries (SELECT/WHERE/ORDER BY/LIMIT); alert rules with threshold evaluation; parser unit tests.
  • Notification Hubs: hub CRUD; registration create/update/delete/list with tag filter; installation upsert API; tag-expression targeted send with &&/||/!/parentheses evaluation; platform-scoped send; sent-notification capture and inspection; tag expression evaluator unit tests.
  • Full HTTP server for all fourteen services including PATCH (queue update-message) and end-to-end round-trips through the live server for all new services.

CI runs the same suite on Ubuntu, macOS, and Windows across Python 3.10–3.13.

Roadmap

The following are not implemented yet and are tracked as roadmap items (they are intentionally not claimed as working):

  • Azure-native SDK / connection-string wire compatibility (current API is a clean local REST surface, not the byte-for-byte Azure REST protocol).
  • Shared Access Signatures (SAS) with actual enforcement (current stub generates signed URLs but does not validate them on GET/PUT).
  • Blob snapshots, page blobs, and append blobs.
  • Full OData $filter language (nested parens, startswith, contains; current subset supports and/or/not, six comparison operators, string/number/bool literals).
  • Cosmos DB stored procedures, triggers, change feed, and cross-partition aggregation queries.
  • File Share SMB/NFS protocol access (current API is HTTP-only).
  • A persistent function scheduler (current timer-trigger must be fired manually via FunctionRunner.fire_timer; no background cron loop).
  • Service Bus: message deferral (state=deferred), scheduled messages (enqueue_time_utc), message sessions across topic subscriptions, and forwarding.
  • Event Hubs: schema registry, Kafka surface, AMQP wire protocol, and capture to Blob Storage.
  • Event Grid: system topics (Azure resource events), event domains, partner topics, and actual outbound HTTP delivery to subscription endpoints.
  • Key Vault: HSM-backed key types, actual RSA/EC key-pair generation (current cipher is a deterministic test XOR), key rotation policies, managed HSM, certificate policy enforcement, and PKCS#12 export.
  • Managed Identity: OAuth 2.0 / OpenID Connect wire protocol compatibility, federated credentials, workload identity federation, and actual JWT RS256 signing.
  • App Configuration: geo-replication, private endpoints, customer-managed key encryption, and KQL-style $filter beyond prefix matching.
  • Azure Monitor: KQL (Kusto Query Language) parser, diagnostic settings, action groups with actual outbound alerting, and Log Analytics workspace wire protocol compatibility.
  • Notification Hubs: actual outbound push delivery to APNs/FCM/WNS endpoints, template notifications with property substitution, PNS feedback processing, and per-installation tag management via PATCH.

Interoperability

openazure composes with the 300+ tool Cognis suite — JSON in/out and a shared OpenAI-compatible /v1 backbone. See INTEROP.md for the suite map, composition patterns, and reference stacks.

Integrations

Forward openazure's findings to STIX/MISP/Sigma/Splunk/Elastic/Slack/webhooks via cognis-connect. See INTEGRATIONS.md.

License

Cognis Open Collaboration License (COCL) 1.0 — see LICENSE.

About

openazure - an independent, open-source LOCAL reimplementation of core Azure primitives (Blob, Table, Queue, Functions) for local development and testing. Not affiliated with Microsoft.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages