-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Library name and version
Azure.ResourceManager 1.3.1
Describe the bug
When loading a generic resource, some of them return an "identity" section with the following payload:
"identity": {
"principalId": "",
"tenantId": "",
"type": "None"
}
It throws a null error for both principalId and tenantId.
Expected behavior
The resource is able to be loaded correctly
Actual behavior
SystemFormatException: One of the identified items was in an invalid format.
The exception is thrown in https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/src/Common/Custom/Models/ManagedServiceIdentity.Serialization.cs on lines 58 and 68.
So far I've come across this on 2 resources, and here are their payloads with extra stuff removed:
{
"value": [
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.DevTestLab/labs/{labName}",
"name": "{labName}",
"type": "Microsoft.DevTestLab/labs",
"location": "eastus2",
"identity": {
"principalId": "",
"tenantId": "",
"type": "None"
}
}
]
},
{
"value": [
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.CognitiveServices/accounts/{name}",
"name": "{name}",
"type": "Microsoft.CognitiveServices/accounts",
"sku": {
"name": "S1"
},
"kind": "TextTranslation",
"location": "northeurope",
"identity": {
"principalId": "",
"tenantId": "",
"type": "None"
}
}
]
}
Reproduction Steps
I included the payload I am receiving from the Azure REST API. I don't know if something needs to change with the model, annotations, or something else to make this work correctly.
I did open #31633 for the same issue in the PolicyInsights library. I'm guessing they are related and have the same fix.
Environment
I'm running this on Windows 11 with .NET version 6.0.9 and Visual Studio 2022