Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApplicationInsightsManagementClient doesn't accept a subscription_id and crashes. #24606

Closed
Bubblyworld opened this issue May 26, 2022 · 5 comments
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. Mgmt This issue is related to a management-plane library. Monitor - ApplicationInsights

Comments

@Bubblyworld
Copy link

  • Package Name: azure-mgmt-applicationinsights
  • Package Version: 3.0.0
  • Operating System: macOS Big Sur
  • Python Version: 3.9

Describe the bug
According to the documentation, ApplicationInsightsManagementClient is supposed to take a subscription_id in the constructor. This is not the case if you try and use the package, which results in this error:

AttributeError: 'ApplicationInsightsManagementClientConfiguration' object has no attribute 'subscription_id'

To Reproduce
Run the following python script:

from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient
from azure.identity import DefaultAzureCredential
creds = DefaultAzureCredential()
aim_client = ApplicationInsightsManagementClient(creds)
ai = aim_client.components.create_or_update(
    "same-resource-group",
    "same-app-insights",
    {
        "kind": "web",
        "location": "West US",
        "application_type": "web",
    }
)

Expected behavior
I expect the above code to provision an ApplicationInsights component. Instead it crashes.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels May 26, 2022
@azure-sdk azure-sdk added Mgmt This issue is related to a management-plane library. Monitor - ApplicationInsights needs-team-triage Workflow: This issue needs the team to triage. labels May 26, 2022
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label May 26, 2022
@Bubblyworld
Copy link
Author

It's possible to work around this bug by manually setting subscription_id, but this is ugly:

    # A hack to fix a bug in azure.mgmt.applicationinsights.
    #   see: https://github.com/Azure/azure-sdk-for-python/issues/24606
    setattr(aim_client._config, "subscription_id", subscription_id)

@catalinaperalta catalinaperalta added bug This issue requires a change to an existing behavior in the product in order to be resolved. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that needs-team-triage Workflow: This issue needs the team to triage. labels May 31, 2022
@ghost ghost added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label May 31, 2022
@ghost
Copy link

ghost commented May 31, 2022

Thank you for your feedback. This has been routed to the support team for assistance.

@Wzb123456789
Copy link
Contributor

Hi @Bubblyworld, thank you for your feedback.
After investigation, the ApplicationInsightsManagementClient method in the code you provided is missing the necessary parameter subscription_id.

It is also suggested in the document that subscription_id is a parameter of the required attribute.

It is recommended that you set the value of the subscription_id parameter in the local environment variable now, and read it when you use it, as shown in the following code:
image

@xiangyan99 xiangyan99 added the issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. label Jun 17, 2022
@ghost
Copy link

ghost commented Jun 17, 2022

Hi @Bubblyworld. 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 ghost removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jun 17, 2022
@ghost
Copy link

ghost commented Jun 24, 2022

Hi @Bubblyworld, 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 ghost closed this as completed Jun 24, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. Mgmt This issue is related to a management-plane library. Monitor - ApplicationInsights
Projects
None yet
Development

No branches or pull requests

7 participants