-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
API Spec link
API Spec version
2018-06-01
Describe the bug
The Data Factory REST API returns encryption fields using PascalCase (KeyName, VaultBaseUrl, KeyVersion), but the API spec defines these fields as camelCase (keyName, vaultBaseUrl, keyVersion).
Because the SDK is generated from the spec, the Go SDK's UnmarshalJSON only recognizes camelCase keys, causing these fields to remain nil even when encryption is configured.
This behavior has been confirmed in SDK versions v8, v9, and v10.
Related SDK issue: Azure/azure-sdk-for-go#25725
Proposed Solution
I would be happy to contribute a fix once the correct approach is confirmed.
Possible approaches include:
- Update the API spec to use PascalCase field names (
KeyName,VaultBaseUrl,KeyVersion) - Add explicit serialization metadata (e.g.,
x-ms-client-name) to align with actual REST API behavior
I am willing to open a PR once the maintainers advise which approach is appropriate.
Expected behavior
The API spec should accurately reflect the casing used in the REST API response.
The encryption fields should be defined as:
KeyName(notkeyName)VaultBaseUrl(notvaultBaseUrl)KeyVersion(notkeyVersion)
Alternatively, explicit serialization metadata should be added so SDKs can correctly unmarshal responses regardless of casing.
Actual behavior
The REST API returns PascalCase fields:
{
"properties": {
"encryption": {
"KeyName": "my-cmk-key",
"VaultBaseUrl": "https://my-keyvault.vault.azure.com",
"KeyVersion": "abc123"
}
}
}
However, the SDK expects camelCase fields based on the spec, so all encryption fields are unmarshalled as nil.
This prevents applications from:
- Detecting whether CMK encryption is enabled
- Auditing encryption configurations
- Validating Data Factory security posture
Reproduction Steps
- Create an Azure Data Factory with CMK encryption enabled
- Call the REST API to get the Data Factory properties:
az rest --method GET --url "https://management.azure.com/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.DataFactory/factories/{factoryName}?api-version=2018-06-01" - Observe that the response contains PascalCase fields (KeyName, VaultBaseUrl, KeyVersion)
- Use the Azure Go SDK (v8/v9/v10) to retrieve the same Data Factory
- Observe that the encryption fields are nil despite being set
Environment
- Azure Go SDK versions: v8, v9, v10
- API version: 2018-06-01
- Verified using: az rest command