pulumi-azure-native
pulumi-azure-native copied to clipboard
Support Authentication PIM Role Management Policies
About
This PR adds support for Role Management Policies, part of Privileged Identity Management (PIM) in the Microsoft.Authentication namespace. It's one part of #2455.
Note that this is about the ARM part of PIM; there's also a Microsoft Graph API part which is not covered by this provider.
This resource wasn't automatically included because it supports only GET and PATCH. The policies are singletons that cannot be created or deleted, only modified via PATCH.
Implementation
Role Management Policies essentially consist of a name which is actually a GUID, and a list of ~20 rules.
Using our existing singleton support defaults.GetDefaultResourceState was tricky because
- there are many policies with many rules, for a total of ~300k lines of JSON for a subscription scope, and there are more scopes, plus
- I believe the defaults can vary per scope and possibly also per customer.
So instead, I've implemented a custom resource that captures the original state of a policy when it's first "created", i.e., added to Pulumi state. When a rule or the whole policy is removed from Pulumi, we look up the original state and re-apply it.
Testing
The e2e/integration test for this resource is special because using PIM requires a paid Entra ID P2 license. We don't have one yet so the test fails (example). This PR looks green because the test is marked as long-running and doesn't run in PR workflows. Hence the draft status while I organize the license.
Does the PR have any schema changes?
Looking good! No breaking changes found.
New resources:
authorization.RoleManagementPolicy
New functions:
authorization.getRoleManagementPolicy
Codecov Report
Attention: Patch coverage is 37.08609% with 95 lines in your changes are missing coverage. Please review.
Project coverage is 56.47%. Comparing base (
048405b) to head (2206dbc).
Additional details and impacted files
@@ Coverage Diff @@
## master #3130 +/- ##
==========================================
- Coverage 56.77% 56.47% -0.30%
==========================================
Files 66 67 +1
Lines 8055 8177 +122
==========================================
+ Hits 4573 4618 +45
- Misses 3049 3113 +64
- Partials 433 446 +13
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Glanced over it but the review effort here is formidable, LMK if you need me as a reviewer, I'm happy to try again. Since there's a lot going on it can be helpful to rebase into step-by-step commits.