DataMigration Security Fix#29736
Open
JiaSeng-v wants to merge 1 commit into
Open
Conversation
| Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR targets a security hardening change in the DataMigration module by avoiding exposure of sensitive credentials in process command-line arguments, primarily by switching several cmdlets to pass parameters via a config file instead of CLI arguments.
Changes:
- Updated multiple DataMigration cmdlets to invoke their console apps using
--configFilewith parameters serialized to a temporary config. - Refreshed module/solution metadata (manifest formatting, solution project GUID, generation metadata, assembly version).
- Added a new UX command definition for
Invoke-AzDataMigrationRetryToSqlDb.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/DataMigration/DataMigration/ChangeLog.md | Adds an Upcoming Release note describing the security fix. |
| src/DataMigration/DataMigration/Az.DataMigration.psd1 | Manifest refresh (date, explicit empty arrays, tag formatting). |
| src/DataMigration/DataMigration.sln | Updates the solution project GUID mapping for Az.DataMigration. |
| src/DataMigration/DataMigration.Autorest/UX/Microsoft.Sql/servers-databaseMigrations.json | New UX metadata for retrying database migrations. |
| src/DataMigration/DataMigration.Autorest/Properties/AssemblyInfo.cs | Aligns assembly version/file version to 1.1.0. |
| src/DataMigration/DataMigration.Autorest/generate-info.json | Updates generator ID metadata. |
| src/DataMigration/DataMigration.Autorest/docs/Az.DataMigration.md | Updates autorest docs module GUID metadata. |
| src/DataMigration/DataMigration.Autorest/custom/Cmdlets/New-AzDataMigrationTdeCertificateMigration.ps1 | Adds guard for optional password and clears plaintext variables after execution (still uses CLI args due to console app limitation). |
| src/DataMigration/DataMigration.Autorest/custom/Cmdlets/New-AzDataMigrationSqlServerSchema.ps1 | Switches console app invocation to --configFile (currently references missing helper). |
| src/DataMigration/DataMigration.Autorest/custom/Cmdlets/New-AzDataMigrationLoginsMigration.ps1 | Switches console app invocation to --configFile (currently references missing helper). |
| src/DataMigration/DataMigration.Autorest/custom/Cmdlets/Get-AzDataMigrationPerformanceDataCollection.ps1 | Switches console app invocation to --configFile (currently references missing helper). |
| src/DataMigration/DataMigration.Autorest/custom/Cmdlets/Get-AzDataMigrationAssessment.ps1 | Switches console app invocation to --configFile (currently references missing helper). |
Comment on lines
+21
to
+24
| * Fixed security issue where sensitive credentials (SQL connection strings, network share passwords) were exposed as plaintext in process command-line arguments | ||
| - Affected cmdlets: 'New-AzDataMigrationLoginsMigration', 'New-AzDataMigrationSqlServerSchema', 'Get-AzDataMigrationAssessment', 'Get-AzDataMigrationPerformanceDataCollection' | ||
| - Credentials are now passed via temporary config files with restrictive ACLs instead of command-line arguments | ||
| - 'New-AzDataMigrationTdeCertificateMigration' still passes credentials via command-line due to TDE Console App not supporting config file input |
Comment on lines
+109
to
+113
| $configFilePath = . "$PSScriptRoot/../../utils/New-SecureConfigFile.ps1" $configParams | ||
| try { | ||
| & $ExePath --configFile $configFilePath | ||
| } finally { | ||
| Remove-Item -Path $configFilePath -Force -ErrorAction SilentlyContinue |
Comment on lines
+123
to
134
| $configFilePath = . "$PSScriptRoot/../../utils/New-SecureConfigFile.ps1" $configParams | ||
| try { | ||
| if ($PSBoundParameters.ContainsKey("Time")) { | ||
| $pro = Start-Process -FilePath $ExePath -ArgumentList "--configFile ""$configFilePath""" -PassThru -NoNewWindow | ||
| Start-Sleep -Seconds $Time | ||
| $pro | Stop-Process | ||
| } else { | ||
| & $ExePath --configFile $configFilePath | ||
| } | ||
| if($NumberOfIterations -eq "") | ||
| { | ||
| $jsonHash.Remove('numberOfIterations') | ||
| } | ||
|
|
||
| $saveAt = Join-Path -Path $DefaultOutputFolder -ChildPath Downloads; | ||
| $saveas = Join-Path -Path $saveAt -ChildPath "tempConfigFileForPerf.json" | ||
| $jsonHash | ConvertTo-Json -depth 100 | Set-Content $saveas | ||
| $pro = Start-Process -FilePath $ExePath -ArgumentList "--configFile ""$saveas""" -PassThru -NoNewWindow | ||
| Start-Sleep -Seconds $Time | ||
| $pro | stop-process | ||
| Remove-Item -Path $saveas | ||
| } finally { | ||
| Remove-Item -Path $configFilePath -Force -ErrorAction SilentlyContinue | ||
| } |
Comment on lines
+162
to
+169
| $configFilePath = . "$PSScriptRoot/../../utils/New-SecureConfigFile.ps1" $configParams | ||
| try { | ||
| # Running LoginsMigration | ||
| Write-Host "Starting Execution..." | ||
| & $ExePath --configFile $configFilePath | ||
| } finally { | ||
| Remove-Item -Path $configFilePath -Force -ErrorAction SilentlyContinue | ||
| } |
Comment on lines
+161
to
166
| $configFilePath = . "$PSScriptRoot/../../utils/New-SecureConfigFile.ps1" $configParams | ||
| try { | ||
| & $ExePath --configFile $configFilePath | ||
| } finally { | ||
| Remove-Item -Path $configFilePath -Force -ErrorAction SilentlyContinue | ||
| } |
| "commands": [ | ||
| { | ||
| "name": "Invoke-AzDataMigrationRetryToSqlDb", | ||
| "description": "Retry on going migration for the database.", |
| }, | ||
| "examples": [ | ||
| { | ||
| "description": "Retry on going migration for the database.", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.mdand reviewed the following information:ChangeLog.mdfile(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.## Upcoming Releaseheader in the past tense.ChangeLog.mdif no new release is required, such as fixing test case only.