Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.52k stars 2.75k forks source link

DeserializationError while listing Data Factory Linked Services #7688

Closed flvndh closed 2 years ago

flvndh commented 4 years ago

Hello,

While trying to run this piece of code to list a factory linked services:

import os

from azure.common.client_factory import get_client_from_cli_profile
from azure.mgmt.datafactory import DataFactoryManagementClient

RESOURCE_GROUP_NAME = os.environ["RESOURCE_GROUP_NAME"]
FACTORY_NAME = os.environ["FACTORY_NAME"]

client = get_client_from_cli_profile(DataFactoryManagementClient)
linked_services = list(client.linked_services.list_by_factory(RESOURCE_GROUP_NAME, FACTORY_NAME))

I get a msrest.exceptions.DeserializationError with this stacktrace:

Traceback (most recent call last):
  File "...\site-packages\msrest\serialization.py", line 1293, in _deserialize
    found_value = key_extractor(attr, attr_desc, data)
  File "...\site-packages\msrest\serialization.py", line 1064, in rest_key_extractor
    return working_data.get(key)
AttributeError: 'str' object has no attribute 'get'

The error seems to occur while trying to deserialize this template (values obfuscated):

{
    "id": "/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.DataFactory/factories/{factory_name}/linkedservices/{linked_service_name}",
    "name": "{linked_service_name}",
    "type": "Microsoft.DataFactory/factories/linkedservices",
    "properties": {
        "annotations": [],
        "type": "PostgreSql",
        "typeProperties": {
            "connectionString": "Host={hostname};Port={port};Database={database};UID={uid};EncryptionMethod={encryption_method}",
            "password": {
                "type": "AzureKeyVaultSecret",
                "store": {
                    "referenceName": "{key_vault_linked_service_name}",
                    "type": "LinkedServiceReference"
                },
                "secretName": "{secret_name}"
            }
        },
        "connectVia": {
            "referenceName": "{integration_runtime_name}",
            "type": "IntegrationRuntimeReference"
        }
    },
    "etag": "{etag}"
}

Do you have any clue on what's going on here ?

kaerm commented 4 years ago

@flvndh thanks for letting us know! I am tagging the right team to take a look at this

ghost commented 2 years ago

Hi @flvndh. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

RAY-316 commented 2 years ago

/unresolve

BigCat20196 commented 2 years ago

Datafactory has released the latest version 2.2.0. this problem has been solved. Thank you.

Fyi: https://pypi.org/project/azure-mgmt-datafactory/2.2.0/

ghost commented 2 years ago

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!