azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

"Warning: Discriminator source is absent or null, use base class ResourceDetails." when serializing SecurityAssessment object

Open flobeier opened this issue 6 years ago • 18 comments

  • Package Name: azure-mgmt-security
  • Package Version: 0.4.1
  • Operating System: Azure Function
  • Python Version: 3.8.2

Describe the bug Warnings are displayed when the Azure Function runs: [Warning] Discriminator source is absent or null, use base class ResourceDetails.

To Reproduce Steps to reproduce the behavior:

  1. Use the following code in an Azure Function:
# Create a generator with EventData objects containing "Unhealthy" security
# assessments
def data_generator():
    # Create Subscription Client and retrieve list of all subscriptions
    ad_credentials = MSIAuthentication()
    client = SubscriptionClient(ad_credentials)
    subscriptions = client.subscriptions.list()

    # Get security assessments for each subscription and yield the assessments
    # with a status of "Unhealthy" as JSON objects
    for subscription in subscriptions:
        try:
            client = SecurityCenter(
                credentials=ad_credentials,
                subscription_id=subscription.subscription_id,
                asc_location="westeurope"
                )
            assessments = client.assessments.list(scope=subscription.id)
            for assessment in assessments:
                if assessment.status.code == "Unhealthy":
                    yield EventData(json.dumps(assessment.as_dict()))
        except Exception as e:
            logging.error(f"Can't get security assessments for subscription \
                {subscription.subscription_id}. {e}")

Expected behavior Warning should be applicable. I'm not sure if that's the case here. If I am doing something wrong I'd be glad if someone could point it out for me.

flobeier avatar Aug 25 '20 16:08 flobeier

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @chlahav.

ghost avatar Aug 26 '20 21:08 ghost

Hi service team, the 'resource_details' of returned assessment don't have property "source".

changlong-liu avatar Aug 27 '20 03:08 changlong-liu

chlahav doesn't own this anymore. Looking for alternative contact person.

AddySanto avatar Nov 16 '20 11:11 AddySanto

Hey,

I'm running into the exact same issue. It looks like it only happens when you access the status object of an assessment. Code snippet below

for assessment in client.assessments.list(scope=sub_id): print(assessment.status.code)

markusbnet avatar Feb 21 '21 12:02 markusbnet

@AddySanto Following up to see if there is any update on this issue? - Thank you

KranthiPakala-MSFT avatar Nov 01 '21 22:11 KranthiPakala-MSFT

Hi @flobeier. 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.

ghost avatar Dec 15 '21 08:12 ghost

Hi @flobeier, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.

ghost avatar Dec 22 '21 10:12 ghost

/unresolve

nadavu avatar Jun 12 '22 10:06 nadavu

Hi nadavu, only the original author of the issue can ask that it be unresolved. Please open a new issue with your scenario and details if you would like to discuss this topic with the team.

ghost avatar Jun 12 '22 10:06 ghost

/unresolve

flobeier avatar Jun 13 '22 12:06 flobeier

@BigCat20196 Please help take a look

RAY-316 avatar Jun 16 '22 08:06 RAY-316

similar issue: https://github.com/Azure/azure-sdk-for-python/issues/24815

msyyc avatar Jun 16 '22 09:06 msyyc

@BigCat20196 @RAY-316 @msyyc do you have a solution?

nadavu avatar Jul 04 '22 14:07 nadavu

Hi @nadavu the issue is addressed and it is swagger issue. Once https://github.com/Azure/azure-rest-api-specs/issues/19530 is solved, SDK could release new version to fix it.

msyyc avatar Jul 05 '22 01:07 msyyc

Hi @flobeier. 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.

ghost avatar Jul 05 '22 01:07 ghost

Hi @flobeier, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.

ghost avatar Jul 12 '22 04:07 ghost

/unresolve still not fixed

flobeier avatar Jan 31 '23 22:01 flobeier

@flobeier this is a restful API issue rather than as SDK issue. We will close the issue and please use https://github.com/Azure/azure-rest-api-specs/issues/19530 to track the problem.

xiangyan99 avatar Aug 25 '23 16:08 xiangyan99