Skip to content

Commit aec228a

Browse files
committed
Document new zone functions
1 parent 66c835f commit aec228a

File tree

2 files changed

+83
-3
lines changed

2 files changed

+83
-3
lines changed

articles/azure-resource-manager/bicep/bicep-functions-resource.md

Lines changed: 81 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ms.topic: reference
55
ms.custom:
66
- devx-track-bicep
77
- build-2025
8-
ms.date: 05/14/2025
8+
ms.date: 06/18/2025
99
---
1010

1111
# Resource functions for Bicep
@@ -825,7 +825,46 @@ Expected output:
825825
| ---- | ---- | ----- |
826826
| logicalZone | String | `1` |
827827

828-
---
828+
## toLogicalZones
829+
830+
`toLogicalZones(subscriptionId, location, physicalZones)`
831+
832+
Returns the logical availability zones (e.g., `1`, `2`, or `3`) corresponding to physical availability zones for a specified subscription in a given Azure region. To convert a single physical zone, use the [`toLogicalZone`](#tologicalzone) function.
833+
834+
Namespace: [az](bicep-functions.md#namespaces-for-functions)
835+
836+
### Parameters
837+
838+
| Parameter | Required | Type | Description |
839+
|:--- |:--- |:--- |:--- |
840+
| subscriptionId | Yes | string | The ID of the Azure subscription (for example, `12345678-1234-1234-1234-1234567890ab`). |
841+
| location | Yes | string | The Azure region that supports availability zones (for example, `westus2`). |
842+
| physicalZones | Yes | array | An array of physical zone names to convert to logical zones (for example, a data center-specific identifier like `westus2-az1`, `westus2-az2`, ...). |
843+
844+
### Return value
845+
846+
An array of logical zone names corresponding to the provided physical zones, (e.g., `1`, `2`, or `3`). If a physical zone is invalid or not supported, an empty string (`''`) is returned.
847+
848+
### Remarks
849+
850+
The `toLogicalZones` function maps physical zone names to their logical zone equivalents for a specified Azure subscription and region. This is useful for configuring or querying resources based on logical zones within an Azure region. The function requires a valid subscription ID, a supported Azure location, and an array of physical zone names. If a physical zone is invalid or not available in the specified location, the function may return an empty string for that zone or throw an error, depending on the context.
851+
852+
### Examples
853+
854+
The following example retrieves the logical zone for a physical zone in West US 2 for a specific subscription:
855+
856+
```bicep
857+
param subscriptionId string = '12345678-1234-1234-1234-1234567890ab'
858+
param physicalZones array = ['westus2-az1', 'westus2-az2', 'westus2-az3']
859+
860+
output logicalZones array = toLogicalZones(subscriptionId, 'westus2', physicalZones)
861+
```
862+
863+
Expected output:
864+
865+
| Name | Type | Value |
866+
| ---- | ---- | ----- |
867+
| logicalZone | array | ["1","2","3"] |
829868

830869
## toPhysicalZone
831870

@@ -900,7 +939,46 @@ Expected output:
900939
| ---- | ---- | ----- |
901940
| physicalZone | String | `westus2-az1` |
902941

903-
---
942+
## toPhysicalZones
943+
944+
`toPhysicalZones(subscriptionId, location, logicalZones)`
945+
946+
Returns the physical availability zone identifiers (e.g., a data center-specific identifier like `westus2-az1`) corresponding to logical availability zones for a specified subscription in a given Azure region. To convert a single logical zone, use the [`toPhysicalZone`](#tophysicalzone) function.
947+
948+
Namespace: [az](bicep-functions.md#namespaces-for-functions)
949+
950+
### Parameters
951+
952+
| Parameter | Required | Type | Description |
953+
|:--- |:--- |:--- |:--- |
954+
| subscriptionId | Yes | string | The ID of the Azure subscription (for example, `12345678-1234-1234-1234-1234567890ab`). |
955+
| location | Yes | string | The Azure region that supports availability zones (for example, `westus2`). |
956+
| logicalZone | Yes | string[] | The logical availability zones (e.g., `1`, `2`, or `3`) to onvert to physical zones. |
957+
958+
### Return value
959+
960+
An array of physical zone names (e.g., `westus2-az1`, `westus2-az2` )corresponding to the provided logical zones. If a logical zone is invalid or not supported, an empty string (`''`) is returned.
961+
962+
### Remarks
963+
964+
The `toPhysicalZones` function maps logical zone names to their physical zone equivalents for a specified Azure subscription and region. This is useful for deploying or configuring resources in specific physical zones within an Azure region. The function requires a valid subscription ID, a supported Azure location, and an array of logical zone names. If a logical zone is invalid or not available in the specified location, the function may return an empty string for that zone or throw an error, depending on the context.
965+
966+
### Examples
967+
968+
The following example retrieves the physical zone for a logical zone in West US 2 for a specific subscription:
969+
970+
```bicep
971+
param subscriptionId string = '12345678-1234-1234-1234-1234567890ab'
972+
param logicalZones array = ['1', '2', '3']
973+
974+
output physicalZones array = toPhysicalZones(subscriptionId, 'westus2', logicalZones)
975+
```
976+
977+
Expected output (assuming logical zone `1` maps to `westus2-az1`, logical zone `1` maps to `westus2-az1`, and logical zone `3` maps to `westus2-az3`):
978+
979+
| Name | Type | Value |
980+
| ---- | ---- | ----- |
981+
| physicalZone | array | ["westus2-az1","westus2-az2","westus2-az3"] |
904982

905983
## Next steps
906984

articles/azure-resource-manager/bicep/bicep-functions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ The following functions are available for getting resource values. Most of these
160160
* [subscriptionResourceId](./bicep-functions-resource.md#subscriptionresourceid)
161161
* [tenantResourceId](./bicep-functions-resource.md#tenantresourceid)
162162
* [toLogicalZone](./bicep-functions-resource.md#tologicalzone)
163+
* [toLogicalZones](./bicep-functions-resource.md#tologicalzones)
163164
* [toPhysicalZone](./bicep-functions-resource.md#tophysicalzone)
165+
* [toPhysicalZones](./bicep-functions-resource.md#tophysicalzones)
164166

165167
## Scope functions
166168

0 commit comments

Comments
 (0)