microsoft-cdktfconstructs 1.6.0__tar.gz → 1.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/LICENSE +1 -1
  2. {microsoft_cdktfconstructs-1.6.0/src/microsoft_cdktfconstructs.egg-info → microsoft_cdktfconstructs-1.7.0}/PKG-INFO +1 -1
  3. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/setup.py +2 -2
  4. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/__init__.py +75 -41
  5. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/_jsii/__init__.py +2 -2
  6. microsoft_cdktfconstructs-1.7.0/src/microsoft_cdktfconstructs/_jsii/terraform-cdk-constructs@1.7.0.jsii.tgz +0 -0
  7. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_policyassignment/__init__.py +56 -14
  8. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_policydefinition/__init__.py +74 -13
  9. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_roleassignment/__init__.py +63 -19
  10. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_roledefinition/__init__.py +31 -2
  11. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0/src/microsoft_cdktfconstructs.egg-info}/PKG-INFO +1 -1
  12. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs.egg-info/SOURCES.txt +1 -1
  13. microsoft_cdktfconstructs-1.6.0/src/microsoft_cdktfconstructs/_jsii/terraform-cdk-constructs@1.6.0.jsii.tgz +0 -0
  14. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/MANIFEST.in +0 -0
  15. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/README.md +0 -0
  16. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/pyproject.toml +0 -0
  17. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/setup.cfg +0 -0
  18. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_actiongroup/__init__.py +0 -0
  19. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_activitylogalert/__init__.py +0 -0
  20. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_aks/__init__.py +0 -0
  21. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_diagnosticsettings/__init__.py +0 -0
  22. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_dnsforwardingruleset/__init__.py +0 -0
  23. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_dnsresolver/__init__.py +0 -0
  24. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_dnszone/__init__.py +0 -0
  25. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_metricalert/__init__.py +0 -0
  26. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_networkinterface/__init__.py +0 -0
  27. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_networksecuritygroup/__init__.py +0 -0
  28. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_privatednszone/__init__.py +0 -0
  29. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_publicipaddress/__init__.py +0 -0
  30. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_resourcegroup/__init__.py +0 -0
  31. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_storageaccount/__init__.py +0 -0
  32. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_subnet/__init__.py +0 -0
  33. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_virtualmachine/__init__.py +0 -0
  34. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_virtualnetwork/__init__.py +0 -0
  35. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_virtualnetworkgateway/__init__.py +0 -0
  36. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_virtualnetworkgatewayconnection/__init__.py +0 -0
  37. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_virtualnetworkmanager/__init__.py +0 -0
  38. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/azure_vmss/__init__.py +0 -0
  39. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/core_azure/__init__.py +0 -0
  40. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/py.typed +0 -0
  41. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs/testing/__init__.py +0 -0
  42. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs.egg-info/dependency_links.txt +0 -0
  43. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs.egg-info/requires.txt +0 -0
  44. {microsoft_cdktfconstructs-1.6.0 → microsoft_cdktfconstructs-1.7.0}/src/microsoft_cdktfconstructs.egg-info/top_level.txt +0 -0
@@ -1,4 +1,4 @@
1
- Copyright (c) 2025 Microsoft
1
+ Copyright (c) 2026 Microsoft
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: microsoft-cdktfconstructs
3
- Version: 1.6.0
3
+ Version: 1.7.0
4
4
  Summary: Azure CDK constructs using AZAPI provider for direct Azure REST API access. Version 1.0.0 - Major breaking change migration from AzureRM to AZAPI.
5
5
  Home-page: https://github.com/azure/terraform-cdk-constructs.git
6
6
  Author: Microsoft
@@ -5,7 +5,7 @@ kwargs = json.loads(
5
5
  """
6
6
  {
7
7
  "name": "microsoft-cdktfconstructs",
8
- "version": "1.6.0",
8
+ "version": "1.7.0",
9
9
  "description": "Azure CDK constructs using AZAPI provider for direct Azure REST API access. Version 1.0.0 - Major breaking change migration from AzureRM to AZAPI.",
10
10
  "license": "MIT",
11
11
  "url": "https://github.com/azure/terraform-cdk-constructs.git",
@@ -53,7 +53,7 @@ kwargs = json.loads(
53
53
  ],
54
54
  "package_data": {
55
55
  "microsoft_cdktfconstructs._jsii": [
56
- "terraform-cdk-constructs@1.6.0.jsii.tgz"
56
+ "terraform-cdk-constructs@1.7.0.jsii.tgz"
57
57
  ],
58
58
  "microsoft_cdktfconstructs": [
59
59
  "py.typed"
@@ -28415,19 +28415,19 @@ class PolicyAssignment(
28415
28415
  Policy Assignments. It automatically handles version resolution, schema validation,
28416
28416
  and property transformation.
28417
28417
 
28418
- Note: Policy assignments can be deployed at subscription, resource group, or resource scope.
28419
- Like policy definitions, they do not have a location property as they are not region-specific.
28418
+ Note: Policy assignments can be deployed at management group, subscription, resource group,
28419
+ or resource scope. Like policy definitions, they do not have a location property as they
28420
+ are not region-specific.
28420
28421
 
28421
28422
  Example::
28422
28423
 
28423
- // Policy assignment with managed identity:
28424
- const assignment = new PolicyAssignment(this, "assignment", {
28425
- name: "deploy-monitoring-assignment",
28424
+ // Policy assignment at management group scope:
28425
+ const mgAssignment = new PolicyAssignment(this, "mgAssignment", {
28426
+ name: "mg-policy-assignment",
28426
28427
  policyDefinitionId: "/providers/Microsoft.Authorization/policyDefinitions/policy-id",
28427
- scope: "/subscriptions/00000000-0000-0000-0000-000000000000",
28428
- identity: {
28429
- type: "SystemAssigned"
28430
- }
28428
+ scope: "/providers/Microsoft.Management/managementGroups/my-mg",
28429
+ displayName: "Management Group Policy",
28430
+ description: "Applies policy across the entire management group hierarchy"
28431
28431
  });
28432
28432
  '''
28433
28433
 
@@ -28471,7 +28471,7 @@ class PolicyAssignment(
28471
28471
  :param scope_: - The scope in which to define this construct.
28472
28472
  :param id: - The unique identifier for this instance.
28473
28473
  :param policy_definition_id: The policy definition ID to assign This can be a built-in or custom policy definition Required property.
28474
- :param scope: The scope at which the policy assignment is applied Can be a subscription, resource group, or resource Required property.
28474
+ :param scope: The scope at which the policy assignment is applied Can be a management group, subscription, resource group, or resource Required property.
28475
28475
  :param description: The policy assignment description Provides detailed information about the assignment.
28476
28476
  :param display_name: The display name of the policy assignment Provides a human-readable name for the assignment.
28477
28477
  :param enforcement_mode: The enforcement mode of the policy assignment. Default: "Default"
@@ -29027,7 +29027,7 @@ class PolicyAssignmentProps(_AzapiResourceProps_141a2340):
29027
29027
  :param name: The name of the resource.
29028
29028
  :param tags: Tags to apply to the resource.
29029
29029
  :param policy_definition_id: The policy definition ID to assign This can be a built-in or custom policy definition Required property.
29030
- :param scope: The scope at which the policy assignment is applied Can be a subscription, resource group, or resource Required property.
29030
+ :param scope: The scope at which the policy assignment is applied Can be a management group, subscription, resource group, or resource Required property.
29031
29031
  :param description: The policy assignment description Provides detailed information about the assignment.
29032
29032
  :param display_name: The display name of the policy assignment Provides a human-readable name for the assignment.
29033
29033
  :param enforcement_mode: The enforcement mode of the policy assignment. Default: "Default"
@@ -29320,7 +29320,7 @@ class PolicyAssignmentProps(_AzapiResourceProps_141a2340):
29320
29320
 
29321
29321
  @builtins.property
29322
29322
  def scope(self) -> builtins.str:
29323
- '''The scope at which the policy assignment is applied Can be a subscription, resource group, or resource Required property.
29323
+ '''The scope at which the policy assignment is applied Can be a management group, subscription, resource group, or resource Required property.
29324
29324
 
29325
29325
  Example::
29326
29326
 
@@ -29478,26 +29478,20 @@ class PolicyDefinition(
29478
29478
 
29479
29479
  Example::
29480
29480
 
29481
- // Policy definition with parameters:
29482
- const policyDefinition = new PolicyDefinition(this, "policy", {
29483
- name: "require-tag-policy",
29484
- displayName: "Require tag on resources",
29481
+ // Policy definition at management group scope:
29482
+ const mgPolicyDefinition = new PolicyDefinition(this, "mgPolicy", {
29483
+ name: "mg-require-tag-policy",
29484
+ parentId: "/providers/Microsoft.Management/managementGroups/my-mg",
29485
+ displayName: "Management Group Tag Policy",
29486
+ description: "Enforces tags across the management group hierarchy",
29485
29487
  policyRule: {
29486
29488
  if: {
29487
- field: "[concat('tags[', parameters('tagName'), ']')]",
29489
+ field: "tags['CostCenter']",
29488
29490
  exists: "false"
29489
29491
  },
29490
29492
  then: {
29491
29493
  effect: "deny"
29492
29494
  }
29493
- },
29494
- parameters: {
29495
- tagName: {
29496
- type: "String",
29497
- metadata: {
29498
- displayName: "Tag Name"
29499
- }
29500
- }
29501
29495
  }
29502
29496
  });
29503
29497
  '''
@@ -29514,6 +29508,7 @@ class PolicyDefinition(
29514
29508
  metadata: typing.Any = None,
29515
29509
  mode: typing.Optional[builtins.str] = None,
29516
29510
  parameters: typing.Any = None,
29511
+ parent_id: typing.Optional[builtins.str] = None,
29517
29512
  policy_type: typing.Optional[builtins.str] = None,
29518
29513
  api_version: typing.Optional[builtins.str] = None,
29519
29514
  enable_migration_analysis: typing.Optional[builtins.bool] = None,
@@ -29545,6 +29540,7 @@ class PolicyDefinition(
29545
29540
  :param metadata: Metadata for the policy definition Used to store additional information like category, version, etc.
29546
29541
  :param mode: The policy mode Determines which resource types will be evaluated. Default: "All"
29547
29542
  :param parameters: Parameters for the policy definition Allows policy assignments to provide values that are used in the policy rule.
29543
+ :param parent_id: The parent scope where the policy definition should be created Can be a management group or subscription scope If not specified, defaults to subscription scope. Default: Subscription scope (auto-detected from client config)
29548
29544
  :param policy_type: The type of policy definition. Default: "Custom"
29549
29545
  :param api_version: Explicit API version to use for this resource. If not specified, the latest active version will be automatically resolved. Use this for version pinning when stability is required over latest features. Default: Latest active version from ApiVersionManager
29550
29546
  :param enable_migration_analysis: Whether to enable migration analysis warnings. When true, the framework will analyze the current version for deprecation status and provide migration recommendations in the deployment output. Default: true
@@ -29574,6 +29570,7 @@ class PolicyDefinition(
29574
29570
  metadata=metadata,
29575
29571
  mode=mode,
29576
29572
  parameters=parameters,
29573
+ parent_id=parent_id,
29577
29574
  policy_type=policy_type,
29578
29575
  api_version=api_version,
29579
29576
  enable_migration_analysis=enable_migration_analysis,
@@ -29640,6 +29637,17 @@ class PolicyDefinition(
29640
29637
  '''Gets the default API version to use when no explicit version is specified Returns the most recent stable version as the default.'''
29641
29638
  return typing.cast(builtins.str, jsii.invoke(self, "defaultVersion", []))
29642
29639
 
29640
+ @jsii.member(jsii_name="resolveParentId")
29641
+ def _resolve_parent_id(self, props: typing.Any) -> builtins.str:
29642
+ '''Overrides parent ID resolution to use parentId from props if provided Policy definitions can be deployed at subscription or management group scope.
29643
+
29644
+ :param props: -
29645
+ '''
29646
+ if __debug__:
29647
+ type_hints = typing.get_type_hints(_typecheckingstub__578b265b90b8718a4c38a1538fd2c5c20601d7325814a578d432b92c44ab93aa)
29648
+ check_type(argname="argument props", value=props, expected_type=type_hints["props"])
29649
+ return typing.cast(builtins.str, jsii.invoke(self, "resolveParentId", [props]))
29650
+
29643
29651
  @jsii.member(jsii_name="resourceType")
29644
29652
  def _resource_type(self) -> builtins.str:
29645
29653
  '''Gets the Azure resource type for Policy Definitions.'''
@@ -29874,6 +29882,7 @@ class PolicyDefinitionProperties:
29874
29882
  "metadata": "metadata",
29875
29883
  "mode": "mode",
29876
29884
  "parameters": "parameters",
29885
+ "parent_id": "parentId",
29877
29886
  "policy_type": "policyType",
29878
29887
  },
29879
29888
  )
@@ -29903,6 +29912,7 @@ class PolicyDefinitionProps(_AzapiResourceProps_141a2340):
29903
29912
  metadata: typing.Any = None,
29904
29913
  mode: typing.Optional[builtins.str] = None,
29905
29914
  parameters: typing.Any = None,
29915
+ parent_id: typing.Optional[builtins.str] = None,
29906
29916
  policy_type: typing.Optional[builtins.str] = None,
29907
29917
  ) -> None:
29908
29918
  '''Properties for the unified Azure Policy Definition.
@@ -29931,6 +29941,7 @@ class PolicyDefinitionProps(_AzapiResourceProps_141a2340):
29931
29941
  :param metadata: Metadata for the policy definition Used to store additional information like category, version, etc.
29932
29942
  :param mode: The policy mode Determines which resource types will be evaluated. Default: "All"
29933
29943
  :param parameters: Parameters for the policy definition Allows policy assignments to provide values that are used in the policy rule.
29944
+ :param parent_id: The parent scope where the policy definition should be created Can be a management group or subscription scope If not specified, defaults to subscription scope. Default: Subscription scope (auto-detected from client config)
29934
29945
  :param policy_type: The type of policy definition. Default: "Custom"
29935
29946
  '''
29936
29947
  if isinstance(lifecycle, dict):
@@ -29961,6 +29972,7 @@ class PolicyDefinitionProps(_AzapiResourceProps_141a2340):
29961
29972
  check_type(argname="argument metadata", value=metadata, expected_type=type_hints["metadata"])
29962
29973
  check_type(argname="argument mode", value=mode, expected_type=type_hints["mode"])
29963
29974
  check_type(argname="argument parameters", value=parameters, expected_type=type_hints["parameters"])
29975
+ check_type(argname="argument parent_id", value=parent_id, expected_type=type_hints["parent_id"])
29964
29976
  check_type(argname="argument policy_type", value=policy_type, expected_type=type_hints["policy_type"])
29965
29977
  self._values: typing.Dict[builtins.str, typing.Any] = {
29966
29978
  "policy_rule": policy_rule,
@@ -30007,6 +30019,8 @@ class PolicyDefinitionProps(_AzapiResourceProps_141a2340):
30007
30019
  self._values["mode"] = mode
30008
30020
  if parameters is not None:
30009
30021
  self._values["parameters"] = parameters
30022
+ if parent_id is not None:
30023
+ self._values["parent_id"] = parent_id
30010
30024
  if policy_type is not None:
30011
30025
  self._values["policy_type"] = policy_type
30012
30026
 
@@ -30290,6 +30304,19 @@ class PolicyDefinitionProps(_AzapiResourceProps_141a2340):
30290
30304
  result = self._values.get("parameters")
30291
30305
  return typing.cast(typing.Any, result)
30292
30306
 
30307
+ @builtins.property
30308
+ def parent_id(self) -> typing.Optional[builtins.str]:
30309
+ '''The parent scope where the policy definition should be created Can be a management group or subscription scope If not specified, defaults to subscription scope.
30310
+
30311
+ :default: Subscription scope (auto-detected from client config)
30312
+
30313
+ Example::
30314
+
30315
+ "/subscriptions/00000000-0000-0000-0000-000000000000"
30316
+ '''
30317
+ result = self._values.get("parent_id")
30318
+ return typing.cast(typing.Optional[builtins.str], result)
30319
+
30293
30320
  @builtins.property
30294
30321
  def policy_type(self) -> typing.Optional[builtins.str]:
30295
30322
  '''The type of policy definition.
@@ -37543,24 +37570,23 @@ class RoleAssignment(
37543
37570
 
37544
37571
  **Important Notes:**
37545
37572
 
37546
- - Role assignments are scoped resources deployed at subscription, resource group,
37547
- or resource level. They do not have a location property as they are not region-specific.
37573
+ - Role assignments are scoped resources deployed at management group, subscription,
37574
+ resource group, or resource level. They do not have a location property as they
37575
+ are not region-specific.
37548
37576
  - The ``name`` property (inherited from AzapiResourceProps) is not used. Azure automatically
37549
37577
  generates a deterministic GUID for role assignment names based on the deployment context.
37550
37578
  This ensures idempotent deployments without duplicate role assignments.
37551
37579
 
37552
37580
  Example::
37553
37581
 
37554
- Conditional assignment with ABAC - Limit access to specific storage containers
37582
+ Management group scoped assignment - Assign Reader role at management group level
37555
37583
 
37556
- const assignment = new RoleAssignment(this, "conditional-assignment", {
37557
- roleDefinitionId: storageRole.id,
37558
- principalId: user.objectId,
37559
- scope: storageAccount.id,
37560
- principalType: "User",
37561
- condition: "@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:name] StringEquals 'logs'",
37562
- conditionVersion: "2.0",
37563
- description: "Grants access only to the logs container",
37584
+ const mgAssignment = new RoleAssignment(this, "mg-assignment", {
37585
+ roleDefinitionId: "/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7",
37586
+ principalId: "00000000-0000-0000-0000-000000000000",
37587
+ scope: "/providers/Microsoft.Management/managementGroups/my-mg",
37588
+ principalType: "Group",
37589
+ description: "Grants read access across the entire management group hierarchy",
37564
37590
  });
37565
37591
  '''
37566
37592
 
@@ -37603,7 +37629,7 @@ class RoleAssignment(
37603
37629
  :param id: - The unique identifier for this instance.
37604
37630
  :param principal_id: The principal ID (object ID) to which the role is assigned This can be a user, group, service principal, or managed identity Required property.
37605
37631
  :param role_definition_id: The role definition ID to assign This can be a built-in or custom role definition Required property.
37606
- :param scope: The scope at which the role assignment is applied Can be a subscription, resource group, or resource Required property.
37632
+ :param scope: The scope at which the role assignment is applied Can be a management group, subscription, resource group, or resource Required property.
37607
37633
  :param condition: The conditions on the role assignment Limits the resources it applies to using ABAC expressions Requires conditionVersion to be set when used.
37608
37634
  :param condition_version: Version of the condition syntax Required when condition is specified. Default: undefined
37609
37635
  :param delegated_managed_identity_resource_id: The delegated Azure Resource Id which contains a Managed Identity Applicable only when the principalType is Group Used for scenarios where a group assignment should use a specific managed identity.
@@ -37666,7 +37692,7 @@ class RoleAssignment(
37666
37692
 
37667
37693
  @jsii.member(jsii_name="createResourceBody")
37668
37694
  def _create_resource_body(self, props: typing.Any) -> typing.Any:
37669
- '''Creates the resource body for the Azure API call Transforms the input properties into the JSON format expected by Azure REST API Note: Role assignments do not have a location property as they are scoped resources (subscription, resource group, or resource level).
37695
+ '''Creates the resource body for the Azure API call Transforms the input properties into the JSON format expected by Azure REST API Note: Role assignments do not have a location property as they are scoped resources (management group, subscription, resource group, or resource level).
37670
37696
 
37671
37697
  The scope property is NOT included in the body as it's read-only and
37672
37698
  automatically derived from the parentId.
@@ -38067,7 +38093,7 @@ class RoleAssignmentProps(_AzapiResourceProps_141a2340):
38067
38093
  :param tags: Tags to apply to the resource.
38068
38094
  :param principal_id: The principal ID (object ID) to which the role is assigned This can be a user, group, service principal, or managed identity Required property.
38069
38095
  :param role_definition_id: The role definition ID to assign This can be a built-in or custom role definition Required property.
38070
- :param scope: The scope at which the role assignment is applied Can be a subscription, resource group, or resource Required property.
38096
+ :param scope: The scope at which the role assignment is applied Can be a management group, subscription, resource group, or resource Required property.
38071
38097
  :param condition: The conditions on the role assignment Limits the resources it applies to using ABAC expressions Requires conditionVersion to be set when used.
38072
38098
  :param condition_version: Version of the condition syntax Required when condition is specified. Default: undefined
38073
38099
  :param delegated_managed_identity_resource_id: The delegated Azure Resource Id which contains a Managed Identity Applicable only when the principalType is Group Used for scenarios where a group assignment should use a specific managed identity.
@@ -38360,7 +38386,7 @@ class RoleAssignmentProps(_AzapiResourceProps_141a2340):
38360
38386
 
38361
38387
  @builtins.property
38362
38388
  def scope(self) -> builtins.str:
38363
- '''The scope at which the role assignment is applied Can be a subscription, resource group, or resource Required property.
38389
+ '''The scope at which the role assignment is applied Can be a management group, subscription, resource group, or resource Required property.
38364
38390
 
38365
38391
  Example::
38366
38392
 
@@ -39256,7 +39282,7 @@ class RoleDefinitionProps(_AzapiResourceProps_141a2340):
39256
39282
 
39257
39283
  Example::
39258
39284
 
39259
- ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-name"]
39285
+ ["/providers/Microsoft.Management/managementGroups/my-mg"]
39260
39286
  '''
39261
39287
  result = self._values.get("assignable_scopes")
39262
39288
  assert result is not None, "Required property 'assignable_scopes' is missing"
@@ -61370,6 +61396,7 @@ def _typecheckingstub__32ade476b8cbca4e3521fe6be3b2d3e62398ec6cb44fb5185a0240678
61370
61396
  metadata: typing.Any = None,
61371
61397
  mode: typing.Optional[builtins.str] = None,
61372
61398
  parameters: typing.Any = None,
61399
+ parent_id: typing.Optional[builtins.str] = None,
61373
61400
  policy_type: typing.Optional[builtins.str] = None,
61374
61401
  api_version: typing.Optional[builtins.str] = None,
61375
61402
  enable_migration_analysis: typing.Optional[builtins.bool] = None,
@@ -61402,6 +61429,12 @@ def _typecheckingstub__a36d716d00273ea6a6af571a1c37fbb7d796ec85b026ce6ee72b0cd90
61402
61429
  """Type checking stubs"""
61403
61430
  pass
61404
61431
 
61432
+ def _typecheckingstub__578b265b90b8718a4c38a1538fd2c5c20601d7325814a578d432b92c44ab93aa(
61433
+ props: typing.Any,
61434
+ ) -> None:
61435
+ """Type checking stubs"""
61436
+ pass
61437
+
61405
61438
  def _typecheckingstub__cb92598a4c3a4da2786ee5794feea197a9e519cd7b198cd953c0dbef404e1fe1(
61406
61439
  *,
61407
61440
  properties: typing.Union[_PolicyDefinitionProperties_ff703616, typing.Dict[builtins.str, typing.Any]],
@@ -61446,6 +61479,7 @@ def _typecheckingstub__c41e2bcae5dca3227727f47f99543edcf6e042d4b4512da008f7559fe
61446
61479
  metadata: typing.Any = None,
61447
61480
  mode: typing.Optional[builtins.str] = None,
61448
61481
  parameters: typing.Any = None,
61482
+ parent_id: typing.Optional[builtins.str] = None,
61449
61483
  policy_type: typing.Optional[builtins.str] = None,
61450
61484
  ) -> None:
61451
61485
  """Type checking stubs"""
@@ -33,9 +33,9 @@ import constructs._jsii
33
33
 
34
34
  __jsii_assembly__ = jsii.JSIIAssembly.load(
35
35
  "@microsoft/terraform-cdk-constructs",
36
- "1.6.0",
36
+ "1.7.0",
37
37
  __name__[0:-6],
38
- "terraform-cdk-constructs@1.6.0.jsii.tgz",
38
+ "terraform-cdk-constructs@1.7.0.jsii.tgz",
39
39
  )
40
40
 
41
41
  __all__ = [
@@ -5,7 +5,7 @@ This module provides a unified, version-aware implementation for managing Azure
5
5
 
6
6
  ## Overview
7
7
 
8
- Azure Policy Assignments apply policy definitions to specific scopes (subscription, resource group, or resource) and provide parameter values for policy enforcement. Policy assignments can configure enforcement modes, managed identities for remediation, and custom non-compliance messages.
8
+ Azure Policy Assignments apply policy definitions to specific scopes (management group, subscription, resource group, or resource) and provide parameter values for policy enforcement. Policy assignments can configure enforcement modes, managed identities for remediation, and custom non-compliance messages.
9
9
 
10
10
  ## Key Features
11
11
 
@@ -14,7 +14,7 @@ Azure Policy Assignments apply policy definitions to specific scopes (subscripti
14
14
  * **Schema-Driven Validation**: Built-in validation based on Azure API schemas
15
15
  * **Type-Safe**: Full TypeScript support with comprehensive interfaces
16
16
  * **JSII Compatible**: Can be used from multiple programming languages
17
- * **Flexible Scoping**: Support for subscription, resource group, and resource-level assignments
17
+ * **Flexible Scoping**: Support for management group, subscription, resource group, and resource-level assignments
18
18
  * **Enforcement Modes**: Control whether policies are enforced or audited
19
19
  * **Managed Identity Support**: Enable remediation for deployIfNotExists and modify policies
20
20
  * **Scope Exclusions**: Exclude specific scopes from policy evaluation
@@ -286,6 +286,14 @@ console.log("Enforcement Mode:", assignment.enforcementMode);
286
286
 
287
287
  Policy assignments can be applied at different organizational levels:
288
288
 
289
+ #### Management Group Scope
290
+
291
+ ```python
292
+ scope: "/providers/Microsoft.Management/managementGroups/my-mg";
293
+ ```
294
+
295
+ Applies to all subscriptions and resources within the management group hierarchy. This is the highest level scope and is ideal for organization-wide policies.
296
+
289
297
  #### Subscription Scope
290
298
 
291
299
  ```python
@@ -385,6 +393,40 @@ Policy Assignment constructs expose the following outputs:
385
393
 
386
394
  ## Examples
387
395
 
396
+ ### Assign Policy at Management Group Level
397
+
398
+ ```python
399
+ // Apply an organization-wide policy at management group scope
400
+ const mgPolicyDefinition = new PolicyDefinition(this, "org-policy", {
401
+ name: "require-resource-tags",
402
+ parentId: "/providers/Microsoft.Management/managementGroups/my-mg",
403
+ displayName: "Require Resource Tags",
404
+ policyRule: {
405
+ if: {
406
+ field: "tags['CostCenter']",
407
+ exists: "false",
408
+ },
409
+ then: {
410
+ effect: "deny",
411
+ },
412
+ },
413
+ });
414
+
415
+ const mgAssignment = new PolicyAssignment(this, "mg-tag-assignment", {
416
+ name: "require-tags-org-wide",
417
+ displayName: "Require Tags Across Organization",
418
+ description: "Enforces required tags across all subscriptions in the management group",
419
+ policyDefinitionId: mgPolicyDefinition.id,
420
+ scope: "/providers/Microsoft.Management/managementGroups/my-mg",
421
+ nonComplianceMessages: [
422
+ {
423
+ message:
424
+ "All resources must have a CostCenter tag for billing and cost allocation purposes.",
425
+ },
426
+ ],
427
+ });
428
+ ```
429
+
388
430
  ### Assign Tag Policy at Subscription Level
389
431
 
390
432
  ```python
@@ -625,19 +667,19 @@ class PolicyAssignment(
625
667
  Policy Assignments. It automatically handles version resolution, schema validation,
626
668
  and property transformation.
627
669
 
628
- Note: Policy assignments can be deployed at subscription, resource group, or resource scope.
629
- Like policy definitions, they do not have a location property as they are not region-specific.
670
+ Note: Policy assignments can be deployed at management group, subscription, resource group,
671
+ or resource scope. Like policy definitions, they do not have a location property as they
672
+ are not region-specific.
630
673
 
631
674
  Example::
632
675
 
633
- // Policy assignment with managed identity:
634
- const assignment = new PolicyAssignment(this, "assignment", {
635
- name: "deploy-monitoring-assignment",
676
+ // Policy assignment at management group scope:
677
+ const mgAssignment = new PolicyAssignment(this, "mgAssignment", {
678
+ name: "mg-policy-assignment",
636
679
  policyDefinitionId: "/providers/Microsoft.Authorization/policyDefinitions/policy-id",
637
- scope: "/subscriptions/00000000-0000-0000-0000-000000000000",
638
- identity: {
639
- type: "SystemAssigned"
640
- }
680
+ scope: "/providers/Microsoft.Management/managementGroups/my-mg",
681
+ displayName: "Management Group Policy",
682
+ description: "Applies policy across the entire management group hierarchy"
641
683
  });
642
684
  '''
643
685
 
@@ -681,7 +723,7 @@ class PolicyAssignment(
681
723
  :param scope_: - The scope in which to define this construct.
682
724
  :param id: - The unique identifier for this instance.
683
725
  :param policy_definition_id: The policy definition ID to assign This can be a built-in or custom policy definition Required property.
684
- :param scope: The scope at which the policy assignment is applied Can be a subscription, resource group, or resource Required property.
726
+ :param scope: The scope at which the policy assignment is applied Can be a management group, subscription, resource group, or resource Required property.
685
727
  :param description: The policy assignment description Provides detailed information about the assignment.
686
728
  :param display_name: The display name of the policy assignment Provides a human-readable name for the assignment.
687
729
  :param enforcement_mode: The enforcement mode of the policy assignment. Default: "Default"
@@ -1237,7 +1279,7 @@ class PolicyAssignmentProps(_AzapiResourceProps_141a2340):
1237
1279
  :param name: The name of the resource.
1238
1280
  :param tags: Tags to apply to the resource.
1239
1281
  :param policy_definition_id: The policy definition ID to assign This can be a built-in or custom policy definition Required property.
1240
- :param scope: The scope at which the policy assignment is applied Can be a subscription, resource group, or resource Required property.
1282
+ :param scope: The scope at which the policy assignment is applied Can be a management group, subscription, resource group, or resource Required property.
1241
1283
  :param description: The policy assignment description Provides detailed information about the assignment.
1242
1284
  :param display_name: The display name of the policy assignment Provides a human-readable name for the assignment.
1243
1285
  :param enforcement_mode: The enforcement mode of the policy assignment. Default: "Default"
@@ -1530,7 +1572,7 @@ class PolicyAssignmentProps(_AzapiResourceProps_141a2340):
1530
1572
 
1531
1573
  @builtins.property
1532
1574
  def scope(self) -> builtins.str:
1533
- '''The scope at which the policy assignment is applied Can be a subscription, resource group, or resource Required property.
1575
+ '''The scope at which the policy assignment is applied Can be a management group, subscription, resource group, or resource Required property.
1534
1576
 
1535
1577
  Example::
1536
1578
 
@@ -347,6 +347,32 @@ Policy Definition constructs expose the following outputs:
347
347
 
348
348
  ## Examples
349
349
 
350
+ ### Policy Definition at Management Group Scope
351
+
352
+ ```python
353
+ // Create a policy definition at management group scope
354
+ // This makes the policy available to all subscriptions under the management group
355
+ new PolicyDefinition(this, "mg-policy", {
356
+ name: "org-wide-tag-policy",
357
+ parentId: "/providers/Microsoft.Management/managementGroups/my-mg",
358
+ displayName: "Organization-Wide Tag Policy",
359
+ description: "Enforces required tags across all subscriptions in the organization",
360
+ policyRule: {
361
+ if: {
362
+ field: "tags['CostCenter']",
363
+ exists: "false",
364
+ },
365
+ then: {
366
+ effect: "deny",
367
+ },
368
+ },
369
+ metadata: {
370
+ category: "Tags",
371
+ version: "1.0.0",
372
+ },
373
+ });
374
+ ```
375
+
350
376
  ### Require Specific Resource Locations
351
377
 
352
378
  ```python
@@ -503,26 +529,20 @@ class PolicyDefinition(
503
529
 
504
530
  Example::
505
531
 
506
- // Policy definition with parameters:
507
- const policyDefinition = new PolicyDefinition(this, "policy", {
508
- name: "require-tag-policy",
509
- displayName: "Require tag on resources",
532
+ // Policy definition at management group scope:
533
+ const mgPolicyDefinition = new PolicyDefinition(this, "mgPolicy", {
534
+ name: "mg-require-tag-policy",
535
+ parentId: "/providers/Microsoft.Management/managementGroups/my-mg",
536
+ displayName: "Management Group Tag Policy",
537
+ description: "Enforces tags across the management group hierarchy",
510
538
  policyRule: {
511
539
  if: {
512
- field: "[concat('tags[', parameters('tagName'), ']')]",
540
+ field: "tags['CostCenter']",
513
541
  exists: "false"
514
542
  },
515
543
  then: {
516
544
  effect: "deny"
517
545
  }
518
- },
519
- parameters: {
520
- tagName: {
521
- type: "String",
522
- metadata: {
523
- displayName: "Tag Name"
524
- }
525
- }
526
546
  }
527
547
  });
528
548
  '''
@@ -539,6 +559,7 @@ class PolicyDefinition(
539
559
  metadata: typing.Any = None,
540
560
  mode: typing.Optional[builtins.str] = None,
541
561
  parameters: typing.Any = None,
562
+ parent_id: typing.Optional[builtins.str] = None,
542
563
  policy_type: typing.Optional[builtins.str] = None,
543
564
  api_version: typing.Optional[builtins.str] = None,
544
565
  enable_migration_analysis: typing.Optional[builtins.bool] = None,
@@ -570,6 +591,7 @@ class PolicyDefinition(
570
591
  :param metadata: Metadata for the policy definition Used to store additional information like category, version, etc.
571
592
  :param mode: The policy mode Determines which resource types will be evaluated. Default: "All"
572
593
  :param parameters: Parameters for the policy definition Allows policy assignments to provide values that are used in the policy rule.
594
+ :param parent_id: The parent scope where the policy definition should be created Can be a management group or subscription scope If not specified, defaults to subscription scope. Default: Subscription scope (auto-detected from client config)
573
595
  :param policy_type: The type of policy definition. Default: "Custom"
574
596
  :param api_version: Explicit API version to use for this resource. If not specified, the latest active version will be automatically resolved. Use this for version pinning when stability is required over latest features. Default: Latest active version from ApiVersionManager
575
597
  :param enable_migration_analysis: Whether to enable migration analysis warnings. When true, the framework will analyze the current version for deprecation status and provide migration recommendations in the deployment output. Default: true
@@ -599,6 +621,7 @@ class PolicyDefinition(
599
621
  metadata=metadata,
600
622
  mode=mode,
601
623
  parameters=parameters,
624
+ parent_id=parent_id,
602
625
  policy_type=policy_type,
603
626
  api_version=api_version,
604
627
  enable_migration_analysis=enable_migration_analysis,
@@ -665,6 +688,17 @@ class PolicyDefinition(
665
688
  '''Gets the default API version to use when no explicit version is specified Returns the most recent stable version as the default.'''
666
689
  return typing.cast(builtins.str, jsii.invoke(self, "defaultVersion", []))
667
690
 
691
+ @jsii.member(jsii_name="resolveParentId")
692
+ def _resolve_parent_id(self, props: typing.Any) -> builtins.str:
693
+ '''Overrides parent ID resolution to use parentId from props if provided Policy definitions can be deployed at subscription or management group scope.
694
+
695
+ :param props: -
696
+ '''
697
+ if __debug__:
698
+ type_hints = typing.get_type_hints(_typecheckingstub__654a1826887b06f5f0eb0d4ebd8791aca0ddea0906f2c8bab902c91a46f42c39)
699
+ check_type(argname="argument props", value=props, expected_type=type_hints["props"])
700
+ return typing.cast(builtins.str, jsii.invoke(self, "resolveParentId", [props]))
701
+
668
702
  @jsii.member(jsii_name="resourceType")
669
703
  def _resource_type(self) -> builtins.str:
670
704
  '''Gets the Azure resource type for Policy Definitions.'''
@@ -899,6 +933,7 @@ class PolicyDefinitionProperties:
899
933
  "metadata": "metadata",
900
934
  "mode": "mode",
901
935
  "parameters": "parameters",
936
+ "parent_id": "parentId",
902
937
  "policy_type": "policyType",
903
938
  },
904
939
  )
@@ -928,6 +963,7 @@ class PolicyDefinitionProps(_AzapiResourceProps_141a2340):
928
963
  metadata: typing.Any = None,
929
964
  mode: typing.Optional[builtins.str] = None,
930
965
  parameters: typing.Any = None,
966
+ parent_id: typing.Optional[builtins.str] = None,
931
967
  policy_type: typing.Optional[builtins.str] = None,
932
968
  ) -> None:
933
969
  '''Properties for the unified Azure Policy Definition.
@@ -956,6 +992,7 @@ class PolicyDefinitionProps(_AzapiResourceProps_141a2340):
956
992
  :param metadata: Metadata for the policy definition Used to store additional information like category, version, etc.
957
993
  :param mode: The policy mode Determines which resource types will be evaluated. Default: "All"
958
994
  :param parameters: Parameters for the policy definition Allows policy assignments to provide values that are used in the policy rule.
995
+ :param parent_id: The parent scope where the policy definition should be created Can be a management group or subscription scope If not specified, defaults to subscription scope. Default: Subscription scope (auto-detected from client config)
959
996
  :param policy_type: The type of policy definition. Default: "Custom"
960
997
  '''
961
998
  if isinstance(lifecycle, dict):
@@ -986,6 +1023,7 @@ class PolicyDefinitionProps(_AzapiResourceProps_141a2340):
986
1023
  check_type(argname="argument metadata", value=metadata, expected_type=type_hints["metadata"])
987
1024
  check_type(argname="argument mode", value=mode, expected_type=type_hints["mode"])
988
1025
  check_type(argname="argument parameters", value=parameters, expected_type=type_hints["parameters"])
1026
+ check_type(argname="argument parent_id", value=parent_id, expected_type=type_hints["parent_id"])
989
1027
  check_type(argname="argument policy_type", value=policy_type, expected_type=type_hints["policy_type"])
990
1028
  self._values: typing.Dict[builtins.str, typing.Any] = {
991
1029
  "policy_rule": policy_rule,
@@ -1032,6 +1070,8 @@ class PolicyDefinitionProps(_AzapiResourceProps_141a2340):
1032
1070
  self._values["mode"] = mode
1033
1071
  if parameters is not None:
1034
1072
  self._values["parameters"] = parameters
1073
+ if parent_id is not None:
1074
+ self._values["parent_id"] = parent_id
1035
1075
  if policy_type is not None:
1036
1076
  self._values["policy_type"] = policy_type
1037
1077
 
@@ -1315,6 +1355,19 @@ class PolicyDefinitionProps(_AzapiResourceProps_141a2340):
1315
1355
  result = self._values.get("parameters")
1316
1356
  return typing.cast(typing.Any, result)
1317
1357
 
1358
+ @builtins.property
1359
+ def parent_id(self) -> typing.Optional[builtins.str]:
1360
+ '''The parent scope where the policy definition should be created Can be a management group or subscription scope If not specified, defaults to subscription scope.
1361
+
1362
+ :default: Subscription scope (auto-detected from client config)
1363
+
1364
+ Example::
1365
+
1366
+ "/subscriptions/00000000-0000-0000-0000-000000000000"
1367
+ '''
1368
+ result = self._values.get("parent_id")
1369
+ return typing.cast(typing.Optional[builtins.str], result)
1370
+
1318
1371
  @builtins.property
1319
1372
  def policy_type(self) -> typing.Optional[builtins.str]:
1320
1373
  '''The type of policy definition.
@@ -1360,6 +1413,7 @@ def _typecheckingstub__d4e28903a06a72000244427e86989df6a69cc84776e7713a5ea395600
1360
1413
  metadata: typing.Any = None,
1361
1414
  mode: typing.Optional[builtins.str] = None,
1362
1415
  parameters: typing.Any = None,
1416
+ parent_id: typing.Optional[builtins.str] = None,
1363
1417
  policy_type: typing.Optional[builtins.str] = None,
1364
1418
  api_version: typing.Optional[builtins.str] = None,
1365
1419
  enable_migration_analysis: typing.Optional[builtins.bool] = None,
@@ -1392,6 +1446,12 @@ def _typecheckingstub__d51b9a44e8620493aa3fd63ad76bd0951072b15d9e32625134dbeec45
1392
1446
  """Type checking stubs"""
1393
1447
  pass
1394
1448
 
1449
+ def _typecheckingstub__654a1826887b06f5f0eb0d4ebd8791aca0ddea0906f2c8bab902c91a46f42c39(
1450
+ props: typing.Any,
1451
+ ) -> None:
1452
+ """Type checking stubs"""
1453
+ pass
1454
+
1395
1455
  def _typecheckingstub__0657ed07126b893992a523233fa3e437c3251a22d3ed4c9a0e0df9d02677dc69(
1396
1456
  *,
1397
1457
  properties: typing.Union[PolicyDefinitionProperties, typing.Dict[builtins.str, typing.Any]],
@@ -1436,6 +1496,7 @@ def _typecheckingstub__ccbdb84b0b985105c2d0fe9b91c8b618a099c872fe29f9344a6d87ae9
1436
1496
  metadata: typing.Any = None,
1437
1497
  mode: typing.Optional[builtins.str] = None,
1438
1498
  parameters: typing.Any = None,
1499
+ parent_id: typing.Optional[builtins.str] = None,
1439
1500
  policy_type: typing.Optional[builtins.str] = None,
1440
1501
  ) -> None:
1441
1502
  """Type checking stubs"""
@@ -1,7 +1,7 @@
1
1
  r'''
2
2
  # Azure Role Assignment Construct
3
3
 
4
- This module provides a CDK construct for managing Azure Role Assignments using the AZAPI provider. Role assignments grant specific permissions (roles) to security principals (users, groups, service principals, managed identities) at a particular scope (subscription, resource group, or resource).
4
+ This module provides a CDK construct for managing Azure Role Assignments using the AZAPI provider. Role assignments grant specific permissions (roles) to security principals (users, groups, service principals, managed identities) at a particular scope (management group, subscription, resource group, or resource).
5
5
 
6
6
  ## Table of Contents
7
7
 
@@ -23,7 +23,7 @@ This module provides a CDK construct for managing Azure Role Assignments using t
23
23
  * **Schema-Driven Validation**: Built-in property validation with comprehensive error messages
24
24
  * **Principal Types**: Support for User, Group, ServicePrincipal, ForeignGroup, and Device principals
25
25
  * **Conditional Access (ABAC)**: Attribute-Based Access Control with condition expressions
26
- * **Flexible Scoping**: Assign roles at subscription, resource group, or individual resource scope
26
+ * **Flexible Scoping**: Assign roles at management group, subscription, resource group, or individual resource scope
27
27
  * **Delegated Managed Identity**: Support for delegated identity scenarios with group assignments
28
28
  * **Built-in and Custom Roles**: Works with both Azure built-in roles and custom role definitions
29
29
  * **JSII Compliance**: Full support for multi-language bindings
@@ -151,6 +151,20 @@ const groupAssignment = new RoleAssignment(this, 'group-assignment', {
151
151
  });
152
152
  ```
153
153
 
154
+ ### Management Group Scoped Assignment
155
+
156
+ ```python
157
+ // Assign a role at management group scope for organization-wide access
158
+ const mgAssignment = new RoleAssignment(this, 'mg-reader', {
159
+ name: 'mg-reader-assignment',
160
+ roleDefinitionId: '/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7', // Reader
161
+ principalId: '00000000-0000-0000-0000-000000000000',
162
+ scope: '/providers/Microsoft.Management/managementGroups/my-mg',
163
+ principalType: 'Group',
164
+ description: 'Grants read access across the entire management group hierarchy',
165
+ });
166
+ ```
167
+
154
168
  ### Resource Group Scoped Assignment
155
169
 
156
170
  ```python
@@ -185,7 +199,7 @@ const resourceAssignment = new RoleAssignment(this, 'storage-contributor', {
185
199
  |----------|------|-------------|
186
200
  | `roleDefinitionId` | string | The role definition ID to assign (built-in or custom role) |
187
201
  | `principalId` | string | The Object ID of the principal (user, group, service principal, managed identity) |
188
- | `scope` | string | The scope at which the role is assigned (subscription, resource group, or resource) |
202
+ | `scope` | string | The scope at which the role is assigned (management group, subscription, resource group, or resource) |
189
203
 
190
204
  ### Optional Properties
191
205
 
@@ -320,6 +334,9 @@ roleDefinitionId: '/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3
320
334
  Assign roles at the narrowest scope possible:
321
335
 
322
336
  ```python
337
+ // ❌ Bad: Management group-wide access when subscription scope is sufficient
338
+ scope: '/providers/Microsoft.Management/managementGroups/my-mg'
339
+
323
340
  // ❌ Bad: Subscription-wide access when not needed
324
341
  scope: '/subscriptions/00000000-0000-0000-0000-000000000000'
325
342
 
@@ -402,7 +419,35 @@ new RoleAssignment(this, 'assignment', {
402
419
 
403
420
  ## Examples
404
421
 
405
- ### Example 1: Multi-Region Monitoring Setup
422
+ ### Example 1: Management Group Level Access Control
423
+
424
+ ```python
425
+ // Grant organization-wide read access to security team at management group level
426
+ const securityReaderAssignment = new RoleAssignment(this, 'security-mg-reader', {
427
+ name: 'security-org-reader',
428
+ roleDefinitionId: '/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7', // Reader
429
+ principalId: securityTeamGroup.objectId,
430
+ scope: '/providers/Microsoft.Management/managementGroups/root-mg',
431
+ principalType: 'Group',
432
+ description: 'Grants security team read access across all subscriptions and resources in the organization',
433
+ tags: {
434
+ team: 'security',
435
+ purpose: 'compliance-monitoring',
436
+ },
437
+ });
438
+
439
+ // Grant User Access Administrator at management group for identity management team
440
+ const identityMgmtAssignment = new RoleAssignment(this, 'identity-mg-uaa', {
441
+ name: 'identity-user-access-admin',
442
+ roleDefinitionId: '/providers/Microsoft.Authorization/roleDefinitions/18d7d88d-d35e-4fb5-a5c3-7773c20a72d9', // User Access Administrator
443
+ principalId: identityTeamGroup.objectId,
444
+ scope: '/providers/Microsoft.Management/managementGroups/root-mg',
445
+ principalType: 'Group',
446
+ description: 'Grants identity team ability to manage role assignments organization-wide',
447
+ });
448
+ ```
449
+
450
+ ### Example 2: Multi-Region Monitoring Setup
406
451
 
407
452
  ```python
408
453
  const regions = ['eastus', 'westus', 'northeurope'];
@@ -579,24 +624,23 @@ class RoleAssignment(
579
624
 
580
625
  **Important Notes:**
581
626
 
582
- - Role assignments are scoped resources deployed at subscription, resource group,
583
- or resource level. They do not have a location property as they are not region-specific.
627
+ - Role assignments are scoped resources deployed at management group, subscription,
628
+ resource group, or resource level. They do not have a location property as they
629
+ are not region-specific.
584
630
  - The ``name`` property (inherited from AzapiResourceProps) is not used. Azure automatically
585
631
  generates a deterministic GUID for role assignment names based on the deployment context.
586
632
  This ensures idempotent deployments without duplicate role assignments.
587
633
 
588
634
  Example::
589
635
 
590
- Conditional assignment with ABAC - Limit access to specific storage containers
636
+ Management group scoped assignment - Assign Reader role at management group level
591
637
 
592
- const assignment = new RoleAssignment(this, "conditional-assignment", {
593
- roleDefinitionId: storageRole.id,
594
- principalId: user.objectId,
595
- scope: storageAccount.id,
596
- principalType: "User",
597
- condition: "@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:name] StringEquals 'logs'",
598
- conditionVersion: "2.0",
599
- description: "Grants access only to the logs container",
638
+ const mgAssignment = new RoleAssignment(this, "mg-assignment", {
639
+ roleDefinitionId: "/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7",
640
+ principalId: "00000000-0000-0000-0000-000000000000",
641
+ scope: "/providers/Microsoft.Management/managementGroups/my-mg",
642
+ principalType: "Group",
643
+ description: "Grants read access across the entire management group hierarchy",
600
644
  });
601
645
  '''
602
646
 
@@ -639,7 +683,7 @@ class RoleAssignment(
639
683
  :param id: - The unique identifier for this instance.
640
684
  :param principal_id: The principal ID (object ID) to which the role is assigned This can be a user, group, service principal, or managed identity Required property.
641
685
  :param role_definition_id: The role definition ID to assign This can be a built-in or custom role definition Required property.
642
- :param scope: The scope at which the role assignment is applied Can be a subscription, resource group, or resource Required property.
686
+ :param scope: The scope at which the role assignment is applied Can be a management group, subscription, resource group, or resource Required property.
643
687
  :param condition: The conditions on the role assignment Limits the resources it applies to using ABAC expressions Requires conditionVersion to be set when used.
644
688
  :param condition_version: Version of the condition syntax Required when condition is specified. Default: undefined
645
689
  :param delegated_managed_identity_resource_id: The delegated Azure Resource Id which contains a Managed Identity Applicable only when the principalType is Group Used for scenarios where a group assignment should use a specific managed identity.
@@ -702,7 +746,7 @@ class RoleAssignment(
702
746
 
703
747
  @jsii.member(jsii_name="createResourceBody")
704
748
  def _create_resource_body(self, props: typing.Any) -> typing.Any:
705
- '''Creates the resource body for the Azure API call Transforms the input properties into the JSON format expected by Azure REST API Note: Role assignments do not have a location property as they are scoped resources (subscription, resource group, or resource level).
749
+ '''Creates the resource body for the Azure API call Transforms the input properties into the JSON format expected by Azure REST API Note: Role assignments do not have a location property as they are scoped resources (management group, subscription, resource group, or resource level).
706
750
 
707
751
  The scope property is NOT included in the body as it's read-only and
708
752
  automatically derived from the parentId.
@@ -1103,7 +1147,7 @@ class RoleAssignmentProps(_AzapiResourceProps_141a2340):
1103
1147
  :param tags: Tags to apply to the resource.
1104
1148
  :param principal_id: The principal ID (object ID) to which the role is assigned This can be a user, group, service principal, or managed identity Required property.
1105
1149
  :param role_definition_id: The role definition ID to assign This can be a built-in or custom role definition Required property.
1106
- :param scope: The scope at which the role assignment is applied Can be a subscription, resource group, or resource Required property.
1150
+ :param scope: The scope at which the role assignment is applied Can be a management group, subscription, resource group, or resource Required property.
1107
1151
  :param condition: The conditions on the role assignment Limits the resources it applies to using ABAC expressions Requires conditionVersion to be set when used.
1108
1152
  :param condition_version: Version of the condition syntax Required when condition is specified. Default: undefined
1109
1153
  :param delegated_managed_identity_resource_id: The delegated Azure Resource Id which contains a Managed Identity Applicable only when the principalType is Group Used for scenarios where a group assignment should use a specific managed identity.
@@ -1396,7 +1440,7 @@ class RoleAssignmentProps(_AzapiResourceProps_141a2340):
1396
1440
 
1397
1441
  @builtins.property
1398
1442
  def scope(self) -> builtins.str:
1399
- '''The scope at which the role assignment is applied Can be a subscription, resource group, or resource Required property.
1443
+ '''The scope at which the role assignment is applied Can be a management group, subscription, resource group, or resource Required property.
1400
1444
 
1401
1445
  Example::
1402
1446
 
@@ -100,6 +100,30 @@ const storageOperator = new RoleDefinition(this, "storage-operator", {
100
100
  });
101
101
  ```
102
102
 
103
+ ### Role with Management Group Scope
104
+
105
+ Define a role that can be assigned at management group level for organization-wide access:
106
+
107
+ ```python
108
+ const orgRole = new RoleDefinition(this, "org-role", {
109
+ name: "org-wide-role",
110
+ roleName: "Organization Reader",
111
+ description: "Can view resources across the entire organization hierarchy",
112
+ permissions: [
113
+ {
114
+ actions: [
115
+ "Microsoft.Resources/subscriptions/read",
116
+ "Microsoft.Resources/subscriptions/resourceGroups/read",
117
+ "Microsoft.Management/managementGroups/read"
118
+ ]
119
+ }
120
+ ],
121
+ assignableScopes: [
122
+ "/providers/Microsoft.Management/managementGroups/my-mg"
123
+ ]
124
+ });
125
+ ```
126
+
103
127
  ### Multiple Assignable Scopes
104
128
 
105
129
  Define a role that can be assigned at multiple levels:
@@ -334,10 +358,15 @@ assignableScopes: [
334
358
  "/subscriptions/sub-id/resourceGroups/production-vms"
335
359
  ]
336
360
 
337
- // Avoid: Too broad if not necessary
361
+ // Acceptable: Subscription level when needed
338
362
  assignableScopes: [
339
363
  "/subscriptions/sub-id"
340
364
  ]
365
+
366
+ // Use carefully: Management group level only for organization-wide roles
367
+ assignableScopes: [
368
+ "/providers/Microsoft.Management/managementGroups/my-mg"
369
+ ]
341
370
  ```
342
371
 
343
372
  ### 5. Separate Control and Data Plane
@@ -1273,7 +1302,7 @@ class RoleDefinitionProps(_AzapiResourceProps_141a2340):
1273
1302
 
1274
1303
  Example::
1275
1304
 
1276
- ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-name"]
1305
+ ["/providers/Microsoft.Management/managementGroups/my-mg"]
1277
1306
  '''
1278
1307
  result = self._values.get("assignable_scopes")
1279
1308
  assert result is not None, "Required property 'assignable_scopes' is missing"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: microsoft-cdktfconstructs
3
- Version: 1.6.0
3
+ Version: 1.7.0
4
4
  Summary: Azure CDK constructs using AZAPI provider for direct Azure REST API access. Version 1.0.0 - Major breaking change migration from AzureRM to AZAPI.
5
5
  Home-page: https://github.com/azure/terraform-cdk-constructs.git
6
6
  Author: Microsoft
@@ -11,7 +11,7 @@ src/microsoft_cdktfconstructs.egg-info/dependency_links.txt
11
11
  src/microsoft_cdktfconstructs.egg-info/requires.txt
12
12
  src/microsoft_cdktfconstructs.egg-info/top_level.txt
13
13
  src/microsoft_cdktfconstructs/_jsii/__init__.py
14
- src/microsoft_cdktfconstructs/_jsii/terraform-cdk-constructs@1.6.0.jsii.tgz
14
+ src/microsoft_cdktfconstructs/_jsii/terraform-cdk-constructs@1.7.0.jsii.tgz
15
15
  src/microsoft_cdktfconstructs/azure_actiongroup/__init__.py
16
16
  src/microsoft_cdktfconstructs/azure_activitylogalert/__init__.py
17
17
  src/microsoft_cdktfconstructs/azure_aks/__init__.py