Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/azure-policyassignment/lib/policy-assignment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,6 @@ export class PolicyAssignment extends AzapiResource {

this.props = props;

// Validate that location is provided when identity is specified
if (props.identity && !this.location) {
throw new Error(
`Location is required for Policy Assignment "${props.name || id}" when identity is specified. ` +
`The managed identity must be provisioned in a specific Azure region.`,
);
}

// Extract properties from the AZAPI resource outputs using Terraform interpolation

// Create Terraform outputs for easy access and referencing from other resources
Expand Down Expand Up @@ -445,8 +437,8 @@ export class PolicyAssignment extends AzapiResource {
// Add identity if provided
if (typedProps.identity) {
body.identity = typedProps.identity;
// Azure requires location when identity is specified for managed identity provisioning
body.location = typedProps.location;
// Note: location is NOT added to the body for policy assignments
// It's handled by the AZAPI provider config for identity provisioning
}

return body;
Expand Down
5 changes: 0 additions & 5 deletions src/azure-policyassignment/test/policy-assignment.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ describe("PolicyAssignment - Unified Implementation", () => {
metadata: {
assignedBy: "admin@example.com",
},
location: "eastus",
identity: {
type: "SystemAssigned",
},
Expand Down Expand Up @@ -341,7 +340,6 @@ describe("PolicyAssignment - Unified Implementation", () => {
metadata: {
assignedBy: "admin@example.com",
},
location: "eastus",
identity: {
type: "SystemAssigned",
},
Expand Down Expand Up @@ -418,7 +416,6 @@ describe("PolicyAssignment - Unified Implementation", () => {
policyDefinitionId:
"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyDefinitions/test-policy",
scope: "/subscriptions/00000000-0000-0000-0000-000000000000",
location: "eastus",
identity: {
type: "SystemAssigned",
},
Expand All @@ -434,7 +431,6 @@ describe("PolicyAssignment - Unified Implementation", () => {
policyDefinitionId:
"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyDefinitions/test-policy",
scope: "/subscriptions/00000000-0000-0000-0000-000000000000",
location: "eastus",
identity: {
type: "UserAssigned",
userAssignedIdentities: {
Expand All @@ -455,7 +451,6 @@ describe("PolicyAssignment - Unified Implementation", () => {
policyDefinitionId:
"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyDefinitions/test-policy",
scope: "/subscriptions/00000000-0000-0000-0000-000000000000",
location: "eastus",
identity: {
type: "None",
},
Expand Down
1 change: 1 addition & 0 deletions src/core-azure/lib/azapi/schema-mapper/schema-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ export class SchemaMapper {
"enableTransformation",
"ignoreChanges",
"resourceGroupId",
"parentId", // AZAPI provider internal property for resource hierarchy
"monitoring", // Framework-level monitoring configuration
"virtualNetworkId", // Framework-level dependency tracking for child resources
]);
Expand Down
Loading