Skip to content
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

[BugFix] GR5 | Validation 1 | AllowedLocationInitiativeId config.json field #348

Merged
merged 13 commits into from
Jan 7, 2025

Conversation

alalvi00
Copy link
Contributor

@alalvi00 alalvi00 commented Jan 7, 2025

Overview/Summary

Title : Update Validation Pattern and Initiative Retrieval Logic

Summary

This update enhances the validation logic and retrieval process for initiative IDs in the solution. Specifically:

  1. The validation pattern now restricts the input to accept only management-level initiative IDs or "N/A".

    • Management-level initiative IDs are validated against the pattern: '(^/providers/Microsoft\.Management/managementGroups/[a-f0-9\-]+/providers/Microsoft\.Authorization/policySetDefinitions/[a-f0-9\-]+)|(N/A)$'
  2. The code for retrieving initiatives has been updated to specifically fetch management-level initiatives.

    • This ensures the solution only processes relevant policy assignments and avoids unnecessary errors.

Impact

  • Improves input validation to prevent invalid data entry.
  • Streamlines the retrieval process by focusing on management-level initiatives, enhancing clarity and performance.
  • Allows for flexibility with the addition of "N/A" as a valid option for cases where initiatives do not apply.

This PR fixes/adds/changes/removes

  1. Confirm-GSAParametersConfiguration.psm1 and psd files are updated
  2. Check-AllowedLocationPolicy.psm1 and psd files are updated
  3. New zip modules are added

Breaking Changes

N/A

Testing Evidence

Added test cases to validate the following scenarios:

  • Correctly formatted management-level initiative IDs.
  • "N/A" as a valid input.
  • Invalid or resource-level initiative IDs are rejected.

Verified successful retrieval of management-level initiatives in compliant test cases.

image

As part of this Pull Request I have

  • Checked for duplicate Pull Requests
  • Associated it with relevant GitHub Issues
  • Ensured my code/branch is up-to-date with the latest changes in the main branch
  • Performed testing and provided evidence.
  • Updated relevant and associated documentation.
  • Ensure PowerShell module versions have been updated (manually or with the ./tools/Update-ModuleVersions.ps1 script)

@alalvi00 alalvi00 linked an issue Jan 7, 2025 that may be closed by this pull request
@alalvi00 alalvi00 changed the title Allowed initiative bug fix aalvi [BugFix] GR5 | Validation 1 | AllowedLocationInitiativeId config.json field Jan 7, 2025
Copy link
Contributor

@dutt0 dutt0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest version update in automation Account bicep

Also is the '-' needed in the regex after /policySetDefinitions/ ?

@alalvi00
Copy link
Contributor Author

alalvi00 commented Jan 7, 2025

Suggest version update in automation Account bicep

Also is the '-' needed in the regex after /policySetDefinitions/ ?

Good catch, its been resolved

@alalvi00 alalvi00 requested a review from dutt0 January 7, 2025 19:01
@alalvi00 alalvi00 merged commit 866fbd4 into main Jan 7, 2025
4 checks passed
@alalvi00 alalvi00 deleted the allowedInitiative-bugFix-aalvi branch January 7, 2025 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GR5 | Validation 1 | AllowedLocationInitiativeId config.json field
3 participants