diff --git a/src/Websites/Websites/ChangeLog.md b/src/Websites/Websites/ChangeLog.md index 6d69398afd1f..96a5e1665714 100644 --- a/src/Websites/Websites/ChangeLog.md +++ b/src/Websites/Websites/ChangeLog.md @@ -22,7 +22,8 @@ - New Cmdlets - New-AzWebAppCertificate - Remove-AzWebAppCertificate - +* Fix bug that causes Docker Password to be removed from appsettings in `Set-AzWebApp` and `Set-AzWebAppSlot` + ## Version 2.1.1 * Prevent duplicate access restriction rules diff --git a/src/Websites/Websites/Cmdlets/DeploymentSlots/SetAzureWebAppSlot.cs b/src/Websites/Websites/Cmdlets/DeploymentSlots/SetAzureWebAppSlot.cs index 9d715c2fba41..86214ba6f841 100644 --- a/src/Websites/Websites/Cmdlets/DeploymentSlots/SetAzureWebAppSlot.cs +++ b/src/Websites/Websites/Cmdlets/DeploymentSlots/SetAzureWebAppSlot.cs @@ -234,11 +234,13 @@ public override void ExecuteCmdlet() } } - appSettings.Remove(CmdletHelpers.DockerRegistryServerPassword); - if (ContainerRegistryPassword != null) { - appSettings[CmdletHelpers.DockerRegistryServerPassword] = ContainerRegistryPassword.ConvertToString(); + appSettings.Remove(CmdletHelpers.DockerRegistryServerPassword); + if (ContainerRegistryPassword.ConvertToString() != string.Empty) + { + appSettings[CmdletHelpers.DockerRegistryServerPassword] = ContainerRegistryPassword.ConvertToString(); + } } if (parameters.Contains("EnableContainerContinuousDeployment")) diff --git a/src/Websites/Websites/Cmdlets/WebApps/SetAzureWebApp.cs b/src/Websites/Websites/Cmdlets/WebApps/SetAzureWebApp.cs index 426f0b183320..7c7c6fcbf83f 100644 --- a/src/Websites/Websites/Cmdlets/WebApps/SetAzureWebApp.cs +++ b/src/Websites/Websites/Cmdlets/WebApps/SetAzureWebApp.cs @@ -236,14 +236,16 @@ public override void ExecuteCmdlet() if (ContainerRegistryUser != string.Empty) { appSettings[CmdletHelpers.DockerRegistryServerUserName] = ContainerRegistryUser; - } + } } - appSettings.Remove(CmdletHelpers.DockerRegistryServerPassword); - if (ContainerRegistryPassword != null) { - appSettings[CmdletHelpers.DockerRegistryServerPassword] = ContainerRegistryPassword.ConvertToString(); + appSettings.Remove(CmdletHelpers.DockerRegistryServerPassword); + if (ContainerRegistryPassword.ConvertToString() != string.Empty) + { + appSettings[CmdletHelpers.DockerRegistryServerPassword] = ContainerRegistryPassword.ConvertToString(); + } } if (parameters.Contains("EnableContainerContinuousDeployment"))