Azure Resource Group Management API Reference
API specification for listing, upserting, and deleting mappings between a project (CSN) and Azure resource groups (RGs). These are the same APIs used by the Azure Resource Group Management page.
📋 Overview
The CSN↔Azure RG mapping APIs are dispatched through the giipApi endpoint via a text command. Authentication uses an AK (byAK): the server resolves the user with @ak → dbo.lwGetUSNbyat(@ak) and then verifies membership of the target CSN (tCorpUserRel/tCorpUser). Non-members receive 403.
- Endpoint:
POST https://giipfaw.azurewebsites.net/api/giipApi - Content-Type:
application/x-www-form-urlencoded - Main form fields:
text(command + parameter names),jsondata(parameter values as JSON), auth key - Binding rule: the order of parameter names in
text= SP parameter order (positional); values are matched by key fromjsondata.
🔍 Commands
1. List mappings — AzureRgList → pApiAzureRgListbyAK
Lists the RG mappings for CSNs the current user can access.
- text:
AzureRgList csn - jsondata:
{ "csn": <CSN> }(omit for all CSNs the user belongs to) - Returns: rows of
carSn, cSn, carResourceGroup, carSubscriptionId, carSubscriptionName, carLSsn, carNote, carStatus, carRegdt, orProc_MSG='403|...'if unauthorized
2. Upsert a mapping — AzureRgPut → pApiAzureRgPutbyAK
Registers a new mapping or updates an existing one (upsert).
- text:
AzureRgPut csn carResourceGroup carSubscriptionId carSubscriptionName carLSsn carNote carSn - jsondata:
{ "csn":<CSN>, "carResourceGroup":"rg-...", "carSubscriptionId":"...", "carSubscriptionName":"...", "carLSsn":<lssn|null>, "carNote":"...", "carSn":<set when updating> } - Rule: with
carSn→ update; without it → upsert keyed by(cSn, carResourceGroup)unique - Returns:
Proc_MSG200|OK/400|.../403|.../404|Not found
3. Delete a mapping — AzureRgDel → pApiAzureRgDelbyAK
Deletes a single mapping by carSn.
- text:
AzureRgDel carSn - jsondata:
{ "carSn": <carSn> } - Returns:
Proc_MSG200|OK/403|.../404|Not found
🛠️ Examples (cURL)
# 1) List RG mappings for CSN 47
curl -X POST "https://giipfaw.azurewebsites.net/api/giipApi" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode 'text=AzureRgList csn' \
--data-urlencode 'jsondata={"csn":47}' \
--data-urlencode 'ak=YOUR_AK'
# 2) Register a new RG mapping
curl -X POST "https://giipfaw.azurewebsites.net/api/giipApi" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode 'text=AzureRgPut csn carResourceGroup carSubscriptionId carSubscriptionName carLSsn carNote carSn' \
--data-urlencode 'jsondata={"csn":47,"carResourceGroup":"rg-example-prod","carSubscriptionName":"prod-sub","carNote":"prod RG"}' \
--data-urlencode 'ak=YOUR_AK'
💡 Notes
- run.ps1 unchanged: these APIs work by adding only three SPs (
pApiAzureRgListbyAK/pApiAzureRgPutbyAK/pApiAzureRgDelbyAK). The protectedrun.ps1is never modified. - Within a CSN, the RG name is unique (
UNIQUE(cSn, carResourceGroup)). CallingAzureRgPutwith the same name and nocarSnupdates the existing row. carLSsnis a cost-source hint used by the Azure Cost integration (this version provides mapping-based filtering/subtotals).
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| `Proc_MSG='403 | ...'` returned | Caller is not a member of the target CSN |
AzureRgPut returns 400 | Missing required value (csn/carResourceGroup) | Always include csn and carResourceGroup |
| An existing mapping is updated unexpectedly | Re-registering the same (csn, RG) without carSn | Use a new RG name to create; specify carSn to update |
jsondata parse error | JSON quote escaping error | Send jsondata as valid, correctly escaped JSON |
RstVal/Proc_MSG is not 200 | Parameter/permission issue | Check the cause code in the API Result Codes guide |
Version: 1.0
Last updated: 2026-07-24
Source: giipv3/public/help/api-azure-rg.en.md
Related documents: