-
Notifications
You must be signed in to change notification settings - Fork 15
Feature/add policy fragment and product #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/add policy fragment and product #24
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support for reusable policy fragments and product associations in APIM modules and samples.
- Introduces a new
policy-fragment.bicepmodule to create/manage APIM policy fragments. - Extends
api.bicepwith aproductNamesparameter, conditional resource association to products, and related outputs. - Updates sample Bicep and XML policy files to wire in policy fragments, product links, and use
!empty()checks.
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| shared/bicep/modules/apim/v1/policy-fragment.bicep | New module for defining and outputting APIM policy fragments |
| shared/bicep/modules/apim/v1/api.bicep | Added productNames param, refined conditions for policies/operations, and product association resource and outputs |
| shared/apim-policies/fragments/pf-http-response-200.xml | Added HTTP-200 response policy fragment |
| shared/apim-policies/fragments/pf-authz-match-any.xml | Added authorization match-any policy fragment |
| samples/*/main.bicep & _TEMPLATE/main.bicep | Switched length(...) > 0 to !empty(...) for arrays in sample modules |
| samples/authX-pro/main.bicep & related XML/IPython notebooks | Wired in policy fragments, products, and updated README link |
| README.md | Added AuthX Pro sample entry |
Comments suppressed due to low confidence (2)
shared/bicep/modules/apim/v1/policy-fragment.bicep:60
- [nitpick] The output
policyFragmentNameshadows the input parameter name; consider renaming the output (e.g.,createdPolicyFragmentName) to avoid confusion.
output policyFragmentName string = policyFragment.name
shared/bicep/modules/apim/v1/api.bicep:149
- There are two closing braces on this line which appears to over-close the
backendand properties blocks; remove the extra}to balance the resource declaration.
} }
| | [General](./samples/general/create.ipynb) | Basic demo of APIM sample setup and policy usage. | All infrastructures | | ||
| | [Load Balancing](./samples/load-balancing/create.ipynb) | Priority and weighted load balancing across backends. | apim-aca, afd-apim (with ACA) | | ||
| | [AuthX](./samples/authx/create.ipynb) | Authentication and role-based authorization in a mock HR API. | All infrastructures | | ||
| | [AuthX Pro](./samples/authx-pro/create.ipynb) | Authentication and role-based authorization in a mock product with multiple APIs and policy fragments. | All infrastructures | |
Copilot
AI
Jun 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link path uses lowercase authx-pro, but the folder is named authX-pro; adjust casing so the link resolves correctly on case-sensitive file systems.
| // @description('Array of product names this API is associated with.') | ||
| // output associatedProducts string[] = productNames | ||
|
|
||
| // @description('Number of products this API is associated with.') | ||
| // output productAssociationCount int = length(productNames) |
Copilot
AI
Jun 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] These commented-out outputs for associated products and count should be either removed if obsolete or uncommented and implemented to avoid dead code clutter.
| // @description('Array of product names this API is associated with.') | |
| // output associatedProducts string[] = productNames | |
| // @description('Number of products this API is associated with.') | |
| // output productAssociationCount int = length(productNames) | |
| @description('Array of product names this API is associated with.') | |
| output associatedProducts string[] = productNames | |
| @description('Number of products this API is associated with.') | |
| output productAssociationCount int = length(productNames) |
| @description('The resource ID for Application Insights') | ||
| param appInsightsId string = '' | ||
|
|
||
| @description('Array of product names to associate this API with. If empty, no product associations will be created.') |
Copilot
AI
Jun 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider adding a module-level header comment to document the new productNames parameter alongside the existing parameters section for consistency.
Resolves #19