Skip to content

DataMigration Security Fix#29736

Open
JiaSeng-v wants to merge 1 commit into
Azure:mainfrom
JiaSeng-v:jiaseng/main/DataMigration-SecurityFix
Open

DataMigration Security Fix#29736
JiaSeng-v wants to merge 1 commit into
Azure:mainfrom
JiaSeng-v:jiaseng/main/DataMigration-SecurityFix

Conversation

@JiaSeng-v

Copy link
Copy Markdown
Contributor

Description

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copilot AI review requested due to automatic review settings June 16, 2026 08:07
@azure-client-tools-bot-prd

Copy link
Copy Markdown
Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 --configFile with 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.",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants