-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
API Spec link
API Spec version
2024-07-01
Describe the bug
The storageAccountId property of batchAccount resource is marked as required. When using patch method to update the batchAccount with auto-generated SDK such as go-azure-sdk, it is unable to remove storageAccountId as an empty string will be assigned to the property. This causes issue as that in hashicorp/terraform-provider-azurerm#31615. To solve the issue, I guess the any of the following two solutions can be applied.
- Do not mark
storageAccountIdasrequired - Define
putmethod forbatchAccount
Expected behavior
By using put method with Azure CLI az rest command, it is possible to remove existing storageAccountId with the following request body.
Request body
{
"identity": {
"type": "None",
"userAssignedIdentities": null
},
"properties": {
"autoStorage": {},
"encryption": {
"keySource": "Microsoft.Batch"
}
},
}Actual behavior
When using go-azure-sdk update method generated from azure-rest-api-specs with terraform-provider-azurerm, even if storageAccountId is not specified, an empty string will be assigned as shown in the request body below due to the required behavior. This causes error as listed below.
Request body
{
"identity": {
"type": "None",
"userAssignedIdentities": null
},
"properties": {
"autoStorage": {
"storageAccountId": ""
},
"encryption": {
"keySource": "Microsoft.Batch"
}
},
}Error
LinkedInvalidPropertyId: Property id '' at path 'properties.autoStorage.storageAccountId' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.
Reproduction Steps
The issue can be reproduced by using go-azure-sdk update method with the request body as mentioned in actual behavior section above.
Environment
uname -a
6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/os-release
Distributor ID: Ubuntu
Description: Ubuntu 24.04.3 LTS
Release: 24.04
Codename: noble
- Azure CLI v2.77.0
- Terraform v1.14.4