fix(azure): register Microsoft.BillingBenefits RP via IaC + runtime ensure (closes #752) - #759
Conversation
|
Warning Review limit reached
More reviews will be available in 34 minutes and 18 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
…closes #752) SP-virgin subscriptions 409 with MissingSubscriptionRegistration on the first Savings Plan order because the Microsoft.BillingBenefits resource provider is not auto-registered. Adding Microsoft.BillingBenefits/register/action to the custom role lets CUDly register the RP on first use without requiring the customer to pre-register it manually via az provider register.
cea0f00 to
09785ee
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
Closes #752 in two complementary layers:
IaC layer (commit 1): adds
Microsoft.BillingBenefits/register/actionto the CUDly custom role in both the ARM template (arm/CUDly-CrossSubscription/template.json) and the Terraform module (terraform/modules/iam/azure/cudly-reservation-role/main.tf), so the managed identity has permission to register the RP.Runtime layer (commit 2): CUDly now actually calls the ARM providers register endpoint on first Savings Plan purchase:
Microsoft.Capacityinline registration logic fromservices/computeinto a sharedproviders/azure/internal/resourceproviders.EnsureRegisteredhelper (GET check then POST register, parameterised on namespace + api-version).services/computeto call the shared helper (no behaviour change).ensureBillingBenefitsProviderRegisteredtoservices/savingsplans.Client-- async.Once-guarded call toEnsureRegisteredwithnamespace="Microsoft.BillingBenefits"andapi-version=2022-11-01(GA version for savings plan orders) -- invoked at the top ofPurchaseCommitment.Tests added
internal/resourceproviders: already-registered (no POST fired), not-registered (POST fired), GET failure (error includes namespace), POST failure (error includes namespace), token failure, nil cred skip.services/savingsplans: registration GET fires beforeBeginCreate, not-registered triggers register POST, registration GET issued only once per client lifetime across multiple purchases.Test plan
go test ./providers/azure/...passes (669 tests, all green)terraform validateclean onterraform/modules/iam/azure/cudly-reservation-roleMicrosoft.BillingBenefitsis not pre-registered, purchasing a Savings Plan via CUDly triggers the registration without a 409MissingSubscriptionRegistration