Azure Quantum Provider
The azure_quantum provider connects QCOS to real QPU hardware through Microsoft's Azure Quantum service. It offers access to Rigetti, Quantinuum, and IonQ QPUs — with the cheapest per-shot pricing of any cloud quantum platform.
Pricing Overview
| Target | Hardware | Qubits | Price | Best for |
|---|---|---|---|---|
rigetti.qpu.ankaa-3 | Rigetti Ankaa-3 (superconducting) | 84 | $0.0009/shot | NISQ variational (VQE, QAOA) |
quantinuum.qpu.h2-1 | Quantinuum H2-1 (ion trap) | 56 | $0.000095/HQC | Deep circuits, high fidelity |
ionq.qpu.forte-1 | IonQ Forte-1 (ion trap) | 35 | $0.00975/shot | Small, high-accuracy |
microsoft.estimator | Classical resource estimator | ∞ | Free | Planning + cost estimation |
Running Shor's algorithm with 8192 shots on Rigetti Ankaa-3: $7.37 total.
The same job on IonQ Forte-1: $79.87.
For large batch runs, Rigetti is 10× cheaper.
Setup
1. Create Azure Quantum Workspace
- Go to portal.azure.com
- Search → "Azure Quantum"
- Create workspace → select providers (Rigetti, Quantinuum, IonQ)
- Region: East US (most providers available there)
2. Get credentials
From your workspace overview page:
Subscription ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Resource ID: /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Quantum/Workspaces/<name>
3. Install Azure Quantum SDK
pip install azure-quantum qiskit-azure-quantum
4. Authenticate
# CLI login (recommended for local dev)
az login
# Or use service principal (for production)
export AZURE_CLIENT_ID="..."
export AZURE_CLIENT_SECRET="..."
export AZURE_TENANT_ID="..."
Using the Azure Quantum Provider
Cheapest cluster (recommended starting point)
from network.node_providers import make_azure_cheap_cluster
from network.distributed_qvm import DistributedQVM, QVMMode
registry = make_azure_cheap_cluster(
azure_resource_id="/subscriptions/xxx/resourceGroups/my-rg/providers/Microsoft.Quantum/Workspaces/my-ws",
subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
include_local_mps=True, # add 2000q MPS fallback node
)
qvm = DistributedQVM(registry, mode=QVMMode.EMULATED, shots=1024)
This registers:
- 1× Rigetti Ankaa-3 node (84q, $0.0009/shot)
- 1× Quantinuum H2-1 node (56q, $0.000095/HQC)
- 1× Microsoft Estimator (free)
- 1× local MPS node (2000q, free fallback) — if
include_local_mps=True
Full Azure registration via ClusterBuilder
from network.node_providers import ClusterBuilder
registry = (
ClusterBuilder()
# Azure QPUs
.add("azure_quantum",
azure_resource_id=RESOURCE_ID,
subscription_id=SUBSCRIPTION_ID,
targets=["rigetti.qpu.ankaa-3", "quantinuum.qpu.h2-1"],
location="eastus")
# Local MPS for large circuits (no Azure cost)
.add("local_gpu_mps", n_nodes=2)
.build()
)
Selecting specific targets only
# Rigetti-only (cheapest)
.add("azure_quantum",
azure_resource_id=RESOURCE_ID,
subscription_id=SUBSCRIPTION_ID,
targets=["rigetti.qpu.ankaa-3"])
# Quantinuum-only (highest fidelity)
.add("azure_quantum",
azure_resource_id=RESOURCE_ID,
subscription_id=SUBSCRIPTION_ID,
targets=["quantinuum.qpu.h2-1"])
Offline behavior (no credentials)
When Azure credentials are missing or the provider can't authenticate, nodes are registered as offline — QCOS automatically falls back to local simulation:
registry = make_azure_cheap_cluster(
azure_resource_id="...",
subscription_id="...",
include_local_mps=True,
)
report = registry.status_report()
# If no Azure creds:
# online_nodes: 1 (local MPS only)
# offline_nodes: 3 (Azure QPUs offline)
No exception is raised — the cluster degrades gracefully.
Routing decisions
The DistributedQVM automatically routes circuit shards to the best available node. With Azure + local nodes, the routing is:
| Circuit size | Preferred node | Fallback |
|---|---|---|
| ≤ 35q | IonQ Forte-1 (highest fidelity) | Rigetti Ankaa-3 |
| ≤ 56q | Quantinuum H2-1 | Rigetti Ankaa-3 |
| ≤ 84q | Rigetti Ankaa-3 | Local MPS (free) |
| > 84q | Local MPS (2000q) | Local CPU |
To force Rigetti for all shards:
from network.distributed_qvm import ShardStrategy
result = qvm.run(circuit, shard_strategy=ShardStrategy.SINGLE_NODE, preferred_node="azure-rigetti-ankaa-3")
Cost estimation before running
Use the Microsoft Estimator (free) to get a cost and resource estimate before committing to a real QPU run:
from qiskit import QuantumCircuit
from network.node_providers import AzureQuantumProvider
# Get estimator node spec
provider = AzureQuantumProvider()
nodes = provider.build_nodes(
azure_resource_id=RESOURCE_ID,
subscription_id=SUBSCRIPTION_ID,
targets=["microsoft.estimator"],
)
print(nodes[0])
# QPUNodeSpec(node_id='azure-microsoft-estimator', max_qubits=65536, ...)
Required pip packages
# Core Azure Quantum
pip install azure-quantum>=1.0
# Qiskit connector (for job submission)
pip install qiskit-azure-quantum>=0.8
# Azure authentication
pip install azure-identity>=1.14
Environment variables
For production/CI use service principal auth:
export AZURE_CLIENT_ID="your-app-id"
export AZURE_CLIENT_SECRET="your-secret"
export AZURE_TENANT_ID="your-tenant-id"
export AZURE_SUBSCRIPTION_ID="your-subscription-id"
export AZURE_QUANTUM_RESOURCE_ID="/subscriptions/.../Workspaces/my-ws"
Then load in Python:
import os
registry = make_azure_cheap_cluster(
azure_resource_id=os.environ["AZURE_QUANTUM_RESOURCE_ID"],
subscription_id=os.environ["AZURE_SUBSCRIPTION_ID"],
)
Troubleshooting
azure.core.exceptions.ClientAuthenticationError
# Refresh CLI login
az login
az account set --subscription "your-subscription-id"
Provider not available in region
Not all providers are available in all regions. Check:
az quantum workspace list-providers \
--location eastus \
--query "[].{Provider:providerId, Targets:targets[].id}"
qiskit_azure_quantum import error
pip install --upgrade qiskit-azure-quantum azure-quantum
Quota / insufficient funds
Azure Quantum requires pre-paid credits per provider. Check your workspace Credits and Quotas in the Azure portal. The Microsoft Estimator is always free.