Skip to content

Commit c60de4e

Browse files
Copilotjtracey93
andcommitted
Fix HTTP 415 error by removing incorrect JSON quote escaping
Co-authored-by: jtracey93 <41163455+jtracey93@users.noreply.github.com>
1 parent 2b89c30 commit c60de4e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/ALZ/Public/Grant-SubscriptionCreatorRole.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,9 @@ Grant-SubscriptionCreatorRole -servicePrincipalObjectId "bd42568a-7dd8-489b-bbbb
132132
"principalTenantId" = $tenantId
133133
}
134134
}
135-
$roleAssignmentPayloadJson = $roleAssignmentHashTable | ConvertTo-Json -Depth 100 -Compress
136-
$roleAssignmentPayloadJson = $roleAssignmentPayloadJson -replace '"', '\"'
135+
$roleAssignmentPayloadJson = $roleAssignmentHashTable | ConvertTo-Json -Depth 100
137136

138-
$grantRbac = $(az rest --method PUT --url "$managementApiPrefix$($billingResourceID)/billingRoleAssignments/$($roleAssignmentName)?api-version=2024-04-01" --body $roleAssignmentPayloadJson) | ConvertFrom-Json
137+
$grantRbac = $(az rest --method PUT --url "$managementApiPrefix$($billingResourceID)/billingRoleAssignments/$($roleAssignmentName)?api-version=2024-04-01" --body "$roleAssignmentPayloadJson") | ConvertFrom-Json
139138

140139
if ($null -eq $grantRbac) {
141140
$errorMessage = "The 'SubscriptionCreator' role could not be granted to the service principal. Please check the error message above and try again."

0 commit comments

Comments
 (0)