Azure / Azure/Azure-Landing-Zones
API don't return needed information to grant SPN permissions in Wiki Create Landingzones
- Dominant language
- PowerShell
- Stars
- 96
- Forks
- 70
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 7
Description
**Describe the bug**
```powershell
# Request billing accounts that the identity has access to
$listOperations = @{
Uri = "https://management.azure.com/providers/Microsoft.Billing/billingaccounts?api-version=2020-05-01"
Headers = @{
Authorization = "Bearer $($token.Token)"
'Content-Type' = 'application/json'
}
Method = 'GET'
}
$listBillingAccount = Invoke-RestMethod @listOperations
# List billing accounts
$listBillingAccount | ConvertTo-Json -Depth 100
# Select first billing account and the corresponding enrollment account
$billingAccount = $listBillingAccount.value[0].id
$enrollmentAccountId = $listBillingAccount.value[0].properties.enrollmentAccounts[0].id
```
Since enrollmentAccount isn't returned in the api call $enrollmentAccountId throw a null exception when trying to assign to a null array.
Hence the following steps in the guide don't work.
I've tried to fix it with bringing more by using the api documentation but it won't return more information
```'https://management.azure.com/providers/Microsoft.Billing/billingAccounts?api-version=2020-05-01&$expand=enrollmentDetails,departments,enrollmentAccounts'```
If you use the **2019-10-01-preview** endpoint all works as expected.
**Steps to reproduce**
1. Follow the guide
Contributor guide
Research direction
Start with the Wiki Create Landingzones guide and reproduce the billing account request using the 2020-05-01 endpoint. Compare its response with the 2019-10-01-preview endpoint and update the guide so the enrollment account information can be obtained; verify the documented steps complete without a null exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell
- Domain
- cloud, documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100