From 2b89c302f0ea9e74bfd71ffcdc5129dcb18053e7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Nov 2025 14:35:31 +0000 Subject: [PATCH 1/2] Initial plan From c60de4e576d4ee902958d95c7234ef4719b1bfe1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Nov 2025 14:42:58 +0000 Subject: [PATCH 2/2] Fix HTTP 415 error by removing incorrect JSON quote escaping Co-authored-by: jtracey93 <41163455+jtracey93@users.noreply.github.com> --- src/ALZ/Public/Grant-SubscriptionCreatorRole.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ALZ/Public/Grant-SubscriptionCreatorRole.ps1 b/src/ALZ/Public/Grant-SubscriptionCreatorRole.ps1 index 555716f..2807c63 100644 --- a/src/ALZ/Public/Grant-SubscriptionCreatorRole.ps1 +++ b/src/ALZ/Public/Grant-SubscriptionCreatorRole.ps1 @@ -132,10 +132,9 @@ Grant-SubscriptionCreatorRole -servicePrincipalObjectId "bd42568a-7dd8-489b-bbbb "principalTenantId" = $tenantId } } - $roleAssignmentPayloadJson = $roleAssignmentHashTable | ConvertTo-Json -Depth 100 -Compress - $roleAssignmentPayloadJson = $roleAssignmentPayloadJson -replace '"', '\"' + $roleAssignmentPayloadJson = $roleAssignmentHashTable | ConvertTo-Json -Depth 100 - $grantRbac = $(az rest --method PUT --url "$managementApiPrefix$($billingResourceID)/billingRoleAssignments/$($roleAssignmentName)?api-version=2024-04-01" --body $roleAssignmentPayloadJson) | ConvertFrom-Json + $grantRbac = $(az rest --method PUT --url "$managementApiPrefix$($billingResourceID)/billingRoleAssignments/$($roleAssignmentName)?api-version=2024-04-01" --body "$roleAssignmentPayloadJson") | ConvertFrom-Json if ($null -eq $grantRbac) { $errorMessage = "The 'SubscriptionCreator' role could not be granted to the service principal. Please check the error message above and try again."