-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: APIM SKUs not deploying due to incorrect param logic (#2565)
## Description <!-- >Thank you for your contribution ! > Please include a summary of the change and which issue is fixed. > Please also include the context. > List any dependencies that are required for this change. Fixes #123 Fixes #456 Closes #123 Closes #456 --> Closes #2561 - Added tests for different SKUs to ensure no more issues in the future - Disable some APIM PSRule tests that are $$ and not necessary for non-prod deployments - fix logic to ensure various SKUs can be deployed and use availability zones and scale units ## Pipeline Reference <!-- Insert your Pipeline Status Badge below --> | Pipeline | | -------- | | [![avm.res.api-management.service](https://github.com/tony-box/bicep-registry-modules/actions/workflows/avm.res.api-management.service.yml/badge.svg?branch=fix%2F2561)](https://github.com/tony-box/bicep-registry-modules/actions/workflows/avm.res.api-management.service.yml) | ## Type of Change <!-- Use the checkboxes [x] on the options that are relevant. --> - [ ] Update to CI Environment or utilities (Non-module affecting changes) - [x] Azure Verified Module updates: - [x] Bugfix containing backwards-compatible bug fixes, and I have NOT bumped the MAJOR or MINOR version in `version.json`: - [x] Someone has opened a bug report issue, and I have included "Closes #{bug_report_issue_number}" in the PR description. - [ ] The bug was found by the module author, and no one has opened an issue to report it yet. - [ ] Feature update backwards compatible feature updates, and I have bumped the MINOR version in `version.json`. - [ ] Breaking changes and I have bumped the MAJOR version in `version.json`. - [x] Update to documentation ## Checklist - [x] I'm sure there are no other open Pull Requests for the same update/change - [x] I have run `Set-AVMModule` locally to generate the supporting module files. - [x] My corresponding pipelines / checks run clean and green without any errors or warnings <!-- Please keep up to date with the contribution guide at https://aka.ms/avm/contribute/bicep --> --------- Co-authored-by: Tony Box <[email protected]>
- Loading branch information
Showing
25 changed files
with
368 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# API Management Services `[Microsoft.ApiManagement/service]` | ||
|
||
This module deploys an API Management Service. | ||
This module deploys an API Management Service. The default deployment is set to use a Premium SKU to align with Microsoft WAF-aligned best practices. In most cases, non-prod deployments should use a lower-tier SKU. | ||
|
||
## Navigation | ||
|
||
|
@@ -16,7 +16,7 @@ This module deploys an API Management Service. | |
|
||
| Resource Type | API Version | | ||
| :-- | :-- | | ||
| `Microsoft.ApiManagement/service` | [2023-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ApiManagement/2023-05-01-preview/service) | | ||
| `Microsoft.ApiManagement/service` | [2023-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ApiManagement/service) | | ||
| `Microsoft.ApiManagement/service/apis` | [2022-08-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ApiManagement/2022-08-01/service/apis) | | ||
| `Microsoft.ApiManagement/service/apis/diagnostics` | [2022-08-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ApiManagement/2022-08-01/service/apis/diagnostics) | | ||
| `Microsoft.ApiManagement/service/apis/policies` | [2022-08-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.ApiManagement/2022-08-01/service/apis/policies) | | ||
|
@@ -45,12 +45,74 @@ The following section provides usage examples for the module, which were used to | |
>**Note**: To reference the module, please use the following syntax `br/public:avm/res/api-management/service:<version>`. | ||
- [Using only defaults](#example-1-using-only-defaults) | ||
- [Using large parameter set](#example-2-using-large-parameter-set) | ||
- [Test deploying apim v2 sku](#example-3-test-deploying-apim-v2-sku) | ||
- [WAF-aligned](#example-4-waf-aligned) | ||
- [Deploying a Consumption SKU](#example-1-deploying-a-consumption-sku) | ||
- [Using only defaults](#example-2-using-only-defaults) | ||
- [Deploying a Developer SKU](#example-3-deploying-a-developer-sku) | ||
- [Using large parameter set](#example-4-using-large-parameter-set) | ||
- [Deploying an APIM v2 sku](#example-5-deploying-an-apim-v2-sku) | ||
- [WAF-aligned](#example-6-waf-aligned) | ||
|
||
### Example 1: _Using only defaults_ | ||
### Example 1: _Deploying a Consumption SKU_ | ||
|
||
This instance deploys the module using a Consumption SKU. | ||
|
||
|
||
<details> | ||
|
||
<summary>via Bicep module</summary> | ||
|
||
```bicep | ||
module service 'br/public:avm/res/api-management/service:<version>' = { | ||
name: 'serviceDeployment' | ||
params: { | ||
// Required parameters | ||
name: 'apiscon001' | ||
publisherEmail: '[email protected]' | ||
publisherName: 'az-amorg-x-001' | ||
// Non-required parameters | ||
location: '<location>' | ||
sku: 'Consumption' | ||
} | ||
} | ||
``` | ||
|
||
</details> | ||
<p> | ||
|
||
<details> | ||
|
||
<summary>via JSON Parameter file</summary> | ||
|
||
```json | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
// Required parameters | ||
"name": { | ||
"value": "apiscon001" | ||
}, | ||
"publisherEmail": { | ||
"value": "[email protected]" | ||
}, | ||
"publisherName": { | ||
"value": "az-amorg-x-001" | ||
}, | ||
// Non-required parameters | ||
"location": { | ||
"value": "<location>" | ||
}, | ||
"sku": { | ||
"value": "Consumption" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
</details> | ||
<p> | ||
|
||
### Example 2: _Using only defaults_ | ||
|
||
This instance deploys the module with the minimum set of required parameters. | ||
|
||
|
@@ -106,7 +168,67 @@ module service 'br/public:avm/res/api-management/service:<version>' = { | |
</details> | ||
<p> | ||
|
||
### Example 2: _Using large parameter set_ | ||
### Example 3: _Deploying a Developer SKU_ | ||
|
||
This instance deploys the module using a Developer SKU. | ||
|
||
|
||
<details> | ||
|
||
<summary>via Bicep module</summary> | ||
|
||
```bicep | ||
module service 'br/public:avm/res/api-management/service:<version>' = { | ||
name: 'serviceDeployment' | ||
params: { | ||
// Required parameters | ||
name: 'apisdev001' | ||
publisherEmail: '[email protected]' | ||
publisherName: 'az-amorg-x-001' | ||
// Non-required parameters | ||
location: '<location>' | ||
sku: 'Developer' | ||
} | ||
} | ||
``` | ||
|
||
</details> | ||
<p> | ||
|
||
<details> | ||
|
||
<summary>via JSON Parameter file</summary> | ||
|
||
```json | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
// Required parameters | ||
"name": { | ||
"value": "apisdev001" | ||
}, | ||
"publisherEmail": { | ||
"value": "[email protected]" | ||
}, | ||
"publisherName": { | ||
"value": "az-amorg-x-001" | ||
}, | ||
// Non-required parameters | ||
"location": { | ||
"value": "<location>" | ||
}, | ||
"sku": { | ||
"value": "Developer" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
</details> | ||
<p> | ||
|
||
### Example 4: _Using large parameter set_ | ||
|
||
This instance deploys the module with most of its features enabled. | ||
|
||
|
@@ -598,9 +720,9 @@ module service 'br/public:avm/res/api-management/service:<version>' = { | |
</details> | ||
<p> | ||
|
||
### Example 3: _Test deploying apim v2 sku_ | ||
### Example 5: _Deploying an APIM v2 sku_ | ||
|
||
This instance deploys the module using a v2 SKU with the minimum set of required parameters. | ||
This instance deploys the module using a v2 SKU. | ||
|
||
|
||
<details> | ||
|
@@ -658,7 +780,7 @@ module service 'br/public:avm/res/api-management/service:<version>' = { | |
</details> | ||
<p> | ||
|
||
### Example 4: _WAF-aligned_ | ||
### Example 6: _WAF-aligned_ | ||
|
||
This instance deploys the module in alignment with the best-practices of the Azure Well-Architected Framework. | ||
|
||
|
@@ -1113,6 +1235,12 @@ module service 'br/public:avm/res/api-management/service:<version>' = { | |
| [`publisherEmail`](#parameter-publisheremail) | string | The email address of the owner of the service. | | ||
| [`publisherName`](#parameter-publishername) | string | The name of the owner of the service. | | ||
|
||
**Conditional parameters** | ||
|
||
| Parameter | Type | Description | | ||
| :-- | :-- | :-- | | ||
| [`skuCapacity`](#parameter-skucapacity) | int | The scale units for this API Management service. Required if using Basic, Standard, or Premium skus. For range of capacities for each sku, reference https://azure.microsoft.com/en-us/pricing/details/api-management/. | | ||
|
||
**Optional parameters** | ||
|
||
| Parameter | Type | Description | | ||
|
@@ -1125,7 +1253,7 @@ module service 'br/public:avm/res/api-management/service:<version>' = { | |
| [`backends`](#parameter-backends) | array | Backends. | | ||
| [`caches`](#parameter-caches) | array | Caches. | | ||
| [`certificates`](#parameter-certificates) | array | List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. | | ||
| [`customProperties`](#parameter-customproperties) | object | Custom properties of the API Management service. | | ||
| [`customProperties`](#parameter-customproperties) | object | Custom properties of the API Management service. Not supported if SKU is Consumption. | | ||
| [`diagnosticSettings`](#parameter-diagnosticsettings) | array | The diagnostic settings of the service. | | ||
| [`disableGateway`](#parameter-disablegateway) | bool | Property only valid for an API Management service deployed in multiple locations. This can be used to disable the gateway in master region. | | ||
| [`enableClientCertificate`](#parameter-enableclientcertificate) | bool | Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. | | ||
|
@@ -1147,12 +1275,11 @@ module service 'br/public:avm/res/api-management/service:<version>' = { | |
| [`restore`](#parameter-restore) | bool | Undelete API Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. | | ||
| [`roleAssignments`](#parameter-roleassignments) | array | Array of role assignments to create. | | ||
| [`sku`](#parameter-sku) | string | The pricing tier of this API Management service. | | ||
| [`skuCount`](#parameter-skucount) | int | The instance size of this API Management service. Not supported with V2 SKUs. If using Consumption, sku should = 0. | | ||
| [`subnetResourceId`](#parameter-subnetresourceid) | string | The full resource ID of a subnet in a virtual network to deploy the API Management service in. | | ||
| [`subscriptions`](#parameter-subscriptions) | array | Subscriptions. | | ||
| [`tags`](#parameter-tags) | object | Tags of the resource. | | ||
| [`virtualNetworkType`](#parameter-virtualnetworktype) | string | The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. | | ||
| [`zones`](#parameter-zones) | array | A list of availability zones denoting where the resource needs to come from. Not supported with V2 SKUs. | | ||
| [`zones`](#parameter-zones) | array | A list of availability zones denoting where the resource needs to come from. Only supported by Premium sku. | | ||
|
||
### Parameter: `name` | ||
|
||
|
@@ -1175,6 +1302,14 @@ The name of the owner of the service. | |
- Required: Yes | ||
- Type: string | ||
|
||
### Parameter: `skuCapacity` | ||
|
||
The scale units for this API Management service. Required if using Basic, Standard, or Premium skus. For range of capacities for each sku, reference https://azure.microsoft.com/en-us/pricing/details/api-management/. | ||
|
||
- Required: No | ||
- Type: int | ||
- Default: `2` | ||
|
||
### Parameter: `additionalLocations` | ||
|
||
Additional datacenter locations of the API Management service. Not supported with V2 SKUs. | ||
|
@@ -1241,7 +1376,7 @@ List of Certificates that need to be installed in the API Management service. Ma | |
|
||
### Parameter: `customProperties` | ||
|
||
Custom properties of the API Management service. | ||
Custom properties of the API Management service. Not supported if SKU is Consumption. | ||
|
||
- Required: No | ||
- Type: object | ||
|
@@ -1704,23 +1839,6 @@ The pricing tier of this API Management service. | |
] | ||
``` | ||
|
||
### Parameter: `skuCount` | ||
|
||
The instance size of this API Management service. Not supported with V2 SKUs. If using Consumption, sku should = 0. | ||
|
||
- Required: No | ||
- Type: int | ||
- Default: `2` | ||
- Allowed: | ||
```Bicep | ||
[ | ||
0 | ||
1 | ||
2 | ||
3 | ||
] | ||
``` | ||
|
||
### Parameter: `subnetResourceId` | ||
|
||
The full resource ID of a subnet in a virtual network to deploy the API Management service in. | ||
|
@@ -1761,7 +1879,7 @@ The type of VPN in which API Management service needs to be configured in. None | |
|
||
### Parameter: `zones` | ||
|
||
A list of availability zones denoting where the resource needs to come from. Not supported with V2 SKUs. | ||
A list of availability zones denoting where the resource needs to come from. Only supported by Premium sku. | ||
|
||
- Required: No | ||
- Type: array | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.