-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Remove secrets in PSAzurerRmAccount from display #16449
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
Conversation
64b7ec6 to
20bd3e9
Compare
src/Accounts/Accounts/ChangeLog.md
Outdated
| --> | ||
|
|
||
| ## Upcoming Release | ||
| * Removed `ServicePrincipalSecret` and `CertificatePassword` in Account of Context from display [#15427] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from display or we have removed them from Azure Context psobject? I remember it is latter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 classes that relate to Account of Context in Az.Accounts, AzureAccount is for internal use and PSAzureRmAccount is for powershell operation. The PR just removes ServicePrincipalSecret and CertificatePassword from PSAzureRmAccount.
Co-authored-by: Dingmeng Xue <dixue@microsoft.com>
|
/azp run azure-powershell - windows-powershell |
|
Azure Pipelines successfully started running 1 pipeline(s). |
The PR is to fix #15427
Service principal secret and service principal certificate are required for service principal user to access Azure resources.
Previously PowerShell can access the plain text values of service principal secret and service principal certificate password using
To improve the security, the PR removes the these 2 attributes from
(Get-AzContext).Accounts, whose type isPSAzurerRmAccount.After the change, the context object retrieved by Get-AzContext no longer has ServicePrincipalSecret and CertificatePassword. The cmdlet Set-AzContext, Rename-AzContext accept context object as the input, which brings the risk that the context without ServicePrincipalSecret and CertificatePassword will be added into context list and even be set as current context and then break the current environment.
To solve the issue, the PR also changes the logic when new context object is added to the context list. Firstly find whether there is an existing object with the same account id, tenant and subscription. If found, merge the attributes in the existing one but absent in the new one to the new one and then add the new one to the context list.
Description
Checklist
CONTRIBUTING.mdChangeLog.mdfile(s) has been updated:ChangeLog.mdfile can be found atsrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md## Upcoming Releaseheader -- no new version header should be added