Is it right that az cli command's result is different from REST API?

Makoto Oda 296 Reputation points
2022-02-10T07:15:37.273+00:00

I think that this question relates to an another question.

When I execute az datafactory linked-service show to get json data of a Azure Key Vault linked service, the output is like the following.

   json  
   {  
     "etag": "<etag value>",  
     "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{dataFactoryName}/linkedservices/<linkedServiceName>",  
     "name": "<linkedServiceName>",  
     "properties": {  
       "additionalProperties": null,  
       "annotations": [],  
       "baseUrl": "https://<keyContainerName>.vault.azure.net/",  
       "connectVia": null,  
       "credential": null,  
       "description": null,  
       "parameters": null,  
       "type": "AzureKeyVault"  
     },  
     "resourceGroup": "<resourceGroupName>",  
     "type": "Microsoft.DataFactory/factories/linkedservices"  
   }  

When I execute REST API ( Pipelines - Get ), the output is like the following.

   json  
   {  
     "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{dataFactoryName}/linkedservices/<linkedServiceName>",  
     "name": "<linkedServiceName>",  
     "type": "Microsoft.DataFactory/factories/linkedservices",  
     "properties": {  
       "type": "AzureKeyVault",  
       "typeProperties": {  
         "baseUrl": "https://<keyContainerName>.vault.azure.net/"  
       },  
       "annotations": []  
     },  
     "etag": "<etag value>"  
   }  

I think that there are differences between the output from REST API and the output from azure cli.

  • When I use azure cli, properties which have null are returned. However, when I use REST API, these properties are not returned.
  • When I use azure cli, baseUrl property is not surrounded by typeProperties.

Why are theare differences between REST API and azure cli?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,624 questions
0 comments No comments
{count} votes

Accepted answer
  1. Saurabh Sharma 23,846 Reputation points Microsoft Employee Moderator
    2022-02-10T23:03:52.013+00:00

    Hi @Makoto Oda ,

    Thanks for using Microsoft Q&A!!
    As per understanding, you would like to know the differences between the CLI output of az datafactory linked-service show vs output of the corresponding REST API.

    As per internal discussion this is by design and here are answers to your question -

    1) Nulls vs No Nulls are by design default.
    2) It's by design from Azure CLI's perspective as Azure CLI uses Python SDK's response directly whose output format is as below.
    173683-image.png
    This is expected as both Python SDK and CLI are implemented according to swagger definition and there are so many services in CLI and it’s difficult/not maintainable to add specific logic for each service in CLI to keep the output the same between CLI and Rest API as different services may have different response format.

    173600-image.png
    One solution may be updating the swagger to let the Python SDK generate the same output between SDK and REST API which is a larger task. However, this feedback has been shared internally to Python SDK team for awareness.

    Please let me know if you have any questions.

    Thanks
    Saurabh


    Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.