Skip to content

Conversation

YanaXu
Copy link
Contributor

@YanaXu YanaXu commented Aug 14, 2024

It's for Content-AzAccount. When it's run, the subscription id and tenant id is not set in context. That's why they are empty in telemetry.
This PR is going to set them before recording the telemetry.

Copy link
Member

@isra-fel isra-fel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR itself looks good.
If we do this, does it make the logic of setting sub id in AzureRMCmdlet.BeginProcessing duplicate, and can we remove that?
Also, this will impact cmdlets that do not inherit AzureRMCmdlet . Please ensure we have tested that scneario. Thanks.

@YanaXu
Copy link
Contributor Author

YanaXu commented Aug 15, 2024

PR itself looks good. If we do this, does it make the logic of setting sub id in AzureRMCmdlet.BeginProcessing duplicate, and can we remove that? Also, this will impact cmdlets that do not inherit AzureRMCmdlet . Please ensure we have tested that scneario. Thanks.

@isra-fel , according to your comment, I changed the update and test the below cmdlets. Their subscription ids and tenant ids are recorded correctly now.

  • Get-AzAksCluster
  • Get-AzConfig
  • Get-AzDatabricksWorkspace
  • Get-AzContainerApp
  • Get-AzEnvironment
  • Get-AzContext
  • Get-AzAccessToken
  • Get-AzSqlVM
  • Connect-AzAccount


IAzureContext context;
_qosEvent.Uid = "defaultid";
if (RequireDefaultContext() && TryGetDefaultContext(out context))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need more time to check if it's safe to remove RequireDefaultContext. Will catch up next week

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YanaXu can you test running some cmdlets that doesn't require a context after clearing the context? They should still work without a context.
Examples are the *DataCollection and ContextAutoSave cmdlets.

Copy link
Member

@isra-fel isra-fel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks good if we verified the above cmdlets

@YanaXu YanaXu merged commit 55e0739 into main Aug 22, 2024
@YanaXu YanaXu deleted the yanxu/telemetry_sub_id branch August 22, 2024 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants