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

Rename inconsistent policy files #1442

Merged
merged 2 commits into from
Oct 11, 2023

Conversation

rozkurt
Copy link
Contributor

@rozkurt rozkurt commented Oct 9, 2023

Overview/Summary

Fixed issue with couple of Policy Definitions file names to align with the actual name of the policies

This PR fixes/adds/changes/removes

  1. Renamed following files:
    Audit-PrivateLinkPrivateDnsZones.json --> Audit-PrivateLinkDnsZones.json
    DenyAction-ActivityLogSettings.json --> DenyAction-ActivityLogs.json
    DenyAction-DiagnosticSettings.json --> DenyAction-DiagnosticLogs.json

Breaking Changes

  1. N/A

Testing Evidence

image
image
image
image

Testing URLs

Azure Public

Deploy To Azure

As part of this Pull Request I have

  • Checked for duplicate Pull Requests
  • Associated it with relevant issues, for tracking and closure.
  • Ensured my code/branch is up-to-date with the latest changes in the main branch
  • Performed testing and provided evidence.
  • Ensured contribution guidance is followed.
  • Updated relevant and associated documentation.
  • Updated the "What's New?" wiki page (located: /docs/wiki/whats-new.md)

@jtracey93 jtracey93 added policy PR: Safe to test 🧪 PRs can run more advanced tests that may deploy or access environments labels Oct 9, 2023
@jtracey93 jtracey93 closed this Oct 9, 2023
@jtracey93 jtracey93 reopened this Oct 9, 2023
@jtracey93
Copy link
Collaborator

Nice work @rozkurt

I checked all files and policies with the below script and you've got them all covered 👍

# get all of the policies in src/resources/microsoft.authorization/policyDefinitions and check the file name, wihtout the extension, matches the policy name in the propoerty of the json file

$policyDefinitions = Get-ChildItem -Path .\src\resources\microsoft.authorization\policyDefinitions -Filter *.json -Recurse -Exclude *.AzureChinaCloud.json, *.AzureUSGovernment.json

$policyDefinitions | ForEach-Object {
  $policyDefinition = Get-Content $_.FullName | ConvertFrom-Json
  $policyName = $policyDefinition.name
  $fileName = $_.Name.Replace(".json", "")
  if ($policyName -ne $fileName) {
    Write-Host "Policy name '$policyName' does not match file name '$fileName' in file '$($_.FullName)'" -ForegroundColor Red
  }
  else {
    Write-Host "Policy name '$policyName' does match file name '$fileName' in file '$($_.FullName)'" -ForegroundColor Green
  }
}

# get all of the policies in src/resources/microsoft.authorization/policySetDefinitions and check the file name, wihtout the extension, matches the policy name in the propoerty of the json file

$policySetDefinitions = Get-ChildItem -Path .\src\resources\microsoft.authorization\policySetDefinitions -Filter *.json -Recurse -Exclude *.AzureChinaCloud.json, *.AzureUSGovernment.json

$policySetDefinitions | ForEach-Object {
  $policyDefinition = Get-Content $_.FullName | ConvertFrom-Json
  $policyName = $policyDefinition.name
  $fileName = $_.Name.Replace(".json", "")
  if ($policyName -ne $fileName) {
    Write-Host "Policy name '$policyName' does not match file name '$fileName' in file '$($_.FullName)'" -ForegroundColor Red
  }
  else {
    Write-Host "Policy name '$policyName' does match file name '$fileName' in file '$($_.FullName)'" -ForegroundColor Green
  }
}

@jtracey93 jtracey93 temporarily deployed to csu-rw October 9, 2023 16:06 — with GitHub Actions Inactive
Copy link
Collaborator

@jtracey93 jtracey93 left a comment

Choose a reason for hiding this comment

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

LGTM

@jtracey93 jtracey93 merged commit 59e2490 into Azure:main Oct 11, 2023
9 checks passed
@rozkurt rozkurt deleted the RenameInconsistentPolicyFiles branch November 9, 2023 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
policy PR: Safe to test 🧪 PRs can run more advanced tests that may deploy or access environments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants