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

[Azure] Need to check whether authentication is done when users use any generated Azure cmdlets #1388

Open
dolauli opened this issue Oct 11, 2024 · 1 comment

Comments

@dolauli
Copy link
Contributor

dolauli commented Oct 11, 2024

Currently, if users do not do authentication before they run any cmdlets, we will return a confused error messages. See Azure/azure-powershell#26183 for a real case.

Instead of we should check whether users have login in. If not, we should throw an error like Run Connect-AzAccount to login

Regarding to how to check whether users have login in. We may have following options.

  1. Check whether there is a context through Get-AzContext
  2. Check whether (Get-AzContext).Subscription.Id is null (there is a limitation for this solution, Id could be null in some cases even the users have login in.)
@isra-fel
Copy link
Member

Option 2 may not be practical considering sub id is not mandatory for data plain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants