# `sc_crawler.vendors._azure`

> Inventory of Microsoft Azure via its APIs: servers, storages, traffic, IPv4 addresses and managed PostgreSQL (Flexible Server), with their prices.

# `sc_crawler.vendors._azure`

**Functions:**

- [**inventory_compliance_frameworks**](#inventory_compliance_frameworks) – Manual list of known compliance frameworks at Azure.
- [**inventory_regions**](#inventory_regions) – List all regions via API call.
- [**inventory_zones**](#inventory_zones) – List all availability zones.
- [**inventory_servers**](#inventory_servers) – List all available instance types in all regions.
- [**inventory_server_prices**](#inventory_server_prices) – List all known server ondemand prices in all regions using the Azure Retail Pricing API.
- [**inventory_server_prices_spot**](#inventory_server_prices_spot) – List all known server spot prices in all regions using the Azure Retail Pricing API.
- [**inventory_storages**](#inventory_storages) – List all storage options via the Compute resource manager client.
- [**inventory_storage_prices**](#inventory_storage_prices) – Look up Storage prices via the Azure Retail Prices API.
- [**inventory_traffic_prices**](#inventory_traffic_prices) – Look up Internet Egress/Ingress prices via the Azure Retail Prices API.
- [**inventory_ipv4_prices**](#inventory_ipv4_prices) – Look up Internet Egress/Ingress prices via the Azure Retail Prices API.
- [**inventory_databases**](#inventory_databases) – List Azure Database for PostgreSQL Flexible Server types in all regions.
- [**inventory_database_prices**](#inventory_database_prices) – List Azure Database for PostgreSQL Flexible Server on-demand prices from the Retail Pricing API.
- [**inventory_database_storages**](#inventory_database_storages) – List all Azure Database for PostgreSQL Flexible Server storage options via the capabilities API.
- [**inventory_database_storage_prices**](#inventory_database_storage_prices) – Look up Azure Database for PostgreSQL Flexible Server storage prices via the Azure Retail Prices API.

**Attributes:**

- [**SERVER_FEATURES**](#server_features) – Map lowercase chars from the server name to features.
- [**STORAGE_PRICE_UNIT_MAPPING**](#storage_price_unit_mapping) ([`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)`[`[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`float`](https://docs.python.org/3/builtins/functions.html#float) | `None]`) – Storage capacity units → multiplier to convert the raw API price to $/GB/month.

## attr <code class="doc-name">SERVER_FEATURES</code> [_azure.py:555–580](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L555-L580)

```python
SERVER_FEATURES = {'a': 'AMD processor', 'p': 'ARM processor', 'b': 'Block Storage performance', 'd': 'Local Disk', 'i': 'Isolated', 'l': 'Low Memory', 'm': 'Memory Intensive', 'n': 'Network Optimized', 't': 'Tiny Memory', 's': 'Premium Storage capable', 'r': 'RDMA capable', 'e': 'Memory Optimized', 'x': 'Unmatched Memory Capacity', 'o': 'o'}
```

Map lowercase chars from the server name to features.

## attr <code class="doc-name">STORAGE_PRICE_UNIT_MAPPING</code> [_azure.py:604–610](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L604-L610)

```python
STORAGE_PRICE_UNIT_MAPPING: dict[str, float | None] = {'1/Month': None, '1 GiB/Month': 1 / _GIB_TO_GB, '1 GB/Month': 1.0, '1 GiB/Hour': _HOURS_PER_MONTH / _GIB_TO_GB, '1 GB/Hour': _HOURS_PER_MONTH}
```

Storage capacity units → multiplier to convert the raw API price to $/GB/month.

## func <code class="doc-name">inventory_compliance_frameworks</code> [_azure.py:1295–1302](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L1295-L1302)

```python
inventory_compliance_frameworks(vendor)
```

Manual list of known compliance frameworks at Azure.

Data collected from <https://learn.microsoft.com/en-us/azure/compliance/>.

## func <code class="doc-name">inventory_regions</code> [_azure.py:1305–1830](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L1305-L1830)

```python
inventory_regions(vendor)
```

List all regions via API call.

Location (country and state) and founding year
were collected manually from
<https://datacenters.microsoft.com/globe/explore/>
and its underlying JSON at
<https://datacenters.microsoft.com/globe/data/geo/regions.json>.

City and the energy source information was collected from
the sustainability fact sheets referenced in the above page and JSON.

Coordinates were provided by the Microsoft API, which doesn't seem
to be very reliable.

Some regions are restricted to specific customer scenarios, such as
disaster recovery within a geography (e.g. `australiacentral2`,
`brazilsoutheast`, `germanynorth`, `norwaywest`, `southafricawest`,
`uaecentral`, `swedensouth`), see
<https://learn.microsoft.com/en-us/azure/reliability/regions-list>.
These are listed if visible to the subscription, but services and SKUs
are usually not available there without a region access request:
<https://learn.microsoft.com/en-us/troubleshoot/azure/general/region-access-request-process>.

## func <code class="doc-name">inventory_zones</code> [_azure.py:1833–1867](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L1833-L1867)

```python
inventory_zones(vendor)
```

List all availability zones.

API call to list existing availability zones ("1", "2", and "3")
for each region, and creating a dummy "0" zone for the regions
without availability zones.

## func <code class="doc-name">inventory_servers</code> [_azure.py:1870–1898](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L1870-L1898)

```python
inventory_servers(vendor)
```

List all available instance types in all regions.

Lifecycle: the retirement date of `_azure_sku_retirement_date` (API, then
`_AZURE_RETIREMENT_RULES`) is stored in `retirement_date` — RETIRED if
it has passed, PLANNED_FOR_RETIREMENT if not yet, otherwise ACTIVE.

## func <code class="doc-name">inventory_server_prices</code> [_azure.py:1901–1906](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L1901-L1906)

```python
inventory_server_prices(vendor)
```

List all known server ondemand prices in all regions using the Azure Retail Pricing API.

More information: <https://learn.microsoft.com/en-us/rest/api/cost-management/retail-prices/azure-retail-prices>.

## func <code class="doc-name">inventory_server_prices_spot</code> [_azure.py:1909–1914](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L1909-L1914)

```python
inventory_server_prices_spot(vendor)
```

List all known server spot prices in all regions using the Azure Retail Pricing API.

See details at [inventory_server_prices](#inventory_server_prices).

## func <code class="doc-name">inventory_storages</code> [_azure.py:1952–2013](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L1952-L2013)

```python
inventory_storages(vendor)
```

List all storage options via the Compute resource manager client.

For more information, see <https://learn.microsoft.com/en-us/azure/virtual-machines/disks-types>.

## func <code class="doc-name">inventory_storage_prices</code> [_azure.py:2016–2106](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L2016-L2106)

```python
inventory_storage_prices(vendor)
```

Look up Storage prices via the Azure Retail Prices API.

For more information, see <https://learn.microsoft.com/en-us/rest/api/cost-management/retail-prices/azure-retail-prices>.

## func <code class="doc-name">inventory_traffic_prices</code> [_azure.py:2109–2169](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L2109-L2169)

```python
inventory_traffic_prices(vendor)
```

Look up Internet Egress/Ingress prices via the Azure Retail Prices API.

For more information, see <https://learn.microsoft.com/en-us/rest/api/cost-management/retail-prices/azure-retail-prices>.

## func <code class="doc-name">inventory_ipv4_prices</code> [_azure.py:2172–2203](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L2172-L2203)

```python
inventory_ipv4_prices(vendor)
```

Look up Internet Egress/Ingress prices via the Azure Retail Prices API.

For more information, see <https://learn.microsoft.com/en-us/rest/api/cost-management/retail-prices/azure-retail-prices>.

## func <code class="doc-name">inventory_databases</code> [_azure.py:2695–3015](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L2695-L3015)

```python
inventory_databases(vendor)
```

List Azure Database for PostgreSQL Flexible Server types in all regions.

Existence comes from Flexible Server capabilities (``supportedServerSkus``)
plus concrete Retail ``Standard_*`` meters only for series already seen in
capabilities (quota-hidden sizes within a real family). Per-vCore series
meters are pricing-only and must not invent VM catalog sizes (e.g. ``DCasv5``
/ ``Dsv6`` vs deployable ``DCadsv5`` / ``Ddsv6``).

SKUs with ``securityProfile`` ConfidentialVM are kept only when capabilities
list them in an ACC region (West Europe / UAE North): other regions can
advertise the same profile for non-startable shapes (e.g. Korea Central
``DCadsv6``) with no ``status``/``reason`` distinguishing them. SKUs with an
explicit disabled capability status are skipped. When ``database_id`` is in
capabilities, those supply vCPUs, memory, HA, engine versions, storage
bounds, and autotuning; otherwise edition defaults apply and vCPUs/memory
come from the matching VM.

## func <code class="doc-name">inventory_database_prices</code> [_azure.py:3018–3104](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L3018-L3104)

```python
inventory_database_prices(vendor)
```

List Azure Database for PostgreSQL Flexible Server on-demand prices from the Retail Pricing API.

SKU catalog comes from ``vendor.databases`` (built by ``inventory_databases`` /
capabilities). Per-region capabilities are not used for pricing: emit a row
whenever Retail has a meter for a known instance in that region.

OfferRestricted=Enabled means this subscription cannot list or provision
Flexible Server SKUs there (empty supportedServerEditions), so capabilities
give no confirmed region availability. Retail list prices may still exist;
we keep those rows.
https://learn.microsoft.com/en-us/azure/postgresql/troubleshoot/how-to-resolve-capacity-errors
https://learn.microsoft.com/en-us/rest/api/postgresql/capabilities-by-location/list

More information: <https://learn.microsoft.com/en-us/rest/api/cost-management/retail-prices/azure-retail-prices>.

## func <code class="doc-name">inventory_database_storages</code> [_azure.py:3107–3264](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L3107-L3264)

```python
inventory_database_storages(vendor)
```

List all Azure Database for PostgreSQL Flexible Server storage options via the capabilities API.

## func <code class="doc-name">inventory_database_storage_prices</code> [_azure.py:3267–3314](https://github.com/SpareCores/sc-crawler/blob/81bb61ea164dda526de4aa6de298810007274f21/src/sc_crawler/vendors/_azure.py#L3267-L3314)

```python
inventory_database_storage_prices(vendor)
```

Look up Azure Database for PostgreSQL Flexible Server storage prices via the Azure Retail Prices API.

For more information, see <https://learn.microsoft.com/en-us/rest/api/cost-management/retail-prices/azure-retail-prices>.
