-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Update invocation from Invoke-Expression to call operator #28506
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
Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
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.
Pull Request Overview
This PR refactors PowerShell script code to replace the use of Invoke-Expression
with the call operator (&
) for executing commands and functions. This change improves security by avoiding string-based command execution and follows PowerShell best practices.
Key Changes
- Replace
Invoke-Expression
calls with the safer call operator (&
) - Clean up code formatting by removing unnecessary line breaks and standardizing brace placement
- Remove semicolons at end of statements following PowerShell conventions
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
tools/Test/SmokeTest/RmCoreSmokeTests.ps1 | Updated command execution in retry function and replaced string concatenation approach with direct call operator usage |
src/Resources/Resources.Test/ScenarioTests/RoleDefinitionTests.ps1 | Replaced Invoke-Expression with call operator and cleaned up function formatting |
src/KeyVault/KeyVault.Test/Scripts/VaultManagedStorageAccountTests.ps1 | Updated multiple test functions to use call operator instead of Invoke-Expression |
src/Compute/Compute.Test/ScenarioTests/VMDynamicTests.ps1 | Replaced Invoke-Expression with call operator for function invocation and updated code formatting |
src/Compute/Compute.Test/ScenarioTests/ComputeTestCommon.ps1 | Updated command execution pattern and cleaned up function formatting throughout |
src/KeyVault/KeyVault.Test/Scripts/VaultManagedStorageAccountTests.ps1
Outdated
Show resolved
Hide resolved
8f0a9be
to
494ac49
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run azure-powershell - powershell-core |
/azp run azure-powershell - powershell-core |
No pipelines are associated with this pull request. |
Azure Pipelines successfully started running 1 pipeline(s). |
Description
Mandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.md
and reviewed the following information:ChangeLog.md
file(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
.## Upcoming Release
header in the past tense.ChangeLog.md
if no new release is required, such as fixing test case only.