Skip to content

Commit 07ca0c8

Browse files
committed
Change Get-​Azure​Rm​Web​App​Publishing​Profile -OutputFile mandatory to option.
OutputFile contains credentials. The current cmdlet returns XML, so you do not need to write it in a file. Mandatory is bad design. fix #4212
1 parent e1d6fb9 commit 07ca0c8

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebAppSlotTests.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,13 @@ function Test-WebAppSlotPublishingProfile
697697

698698
# Assert
699699
Assert-True { $fileZillaProfile.Name -eq $appWithSlotName3 }
700+
701+
# Get web app publishing profile without OutputFile
702+
[xml]$profile = Get-AzureRmWebAppSlotPublishingProfile -ResourceGroupName $rgname -Name $appname -Slot $slotname
703+
704+
# Assert
705+
Assert-NotNull $profile
706+
700707
}
701708
finally
702709
{

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebAppTests.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,13 @@ function Test-WebAppPublishingProfile
732732

733733
# Assert
734734
Assert-True { $fileZillaProfile.Name -eq $appName }
735+
736+
# Get web app publishing profile without OutputFile
737+
[xml]$profile = Get-AzureRmWebAppPublishingProfile -ResourceGroupName $rgname -Name $appName
738+
739+
# Assert
740+
Assert-NotNull $profile
741+
735742
}
736743
finally
737744
{

src/ResourceManager/Websites/Commands.Websites/Cmdlets/DeploymentSlots/GetAzureWebAppSlotPublishingProfile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class GetAzureWebAppSlotPublishingProfileCmdlet : WebAppSlotBaseCmdlet
2828
{
2929
private const string DefaultFormat = "WebDeploy";
3030

31-
[Parameter(Position = 3, Mandatory = true, HelpMessage = "The file the publishing profile will we saved as")]
31+
[Parameter(Position = 3, Mandatory = false, HelpMessage = "The file the publishing profile will we saved as")]
3232
public string OutputFile { get; set; }
3333

3434
[Parameter(Position = 4, Mandatory = false, HelpMessage = "The format of the profile. Allowed values are [WebDeploy|FileZilla3|Ftp]. Default value is WebDeploy")]

src/ResourceManager/Websites/Commands.Websites/Cmdlets/WebApps/GetAzureWebAppPublishingProfile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class GetAzureWebAppPublishingProfileCmdlet : WebAppBaseCmdlet
2626
{
2727
private const string DefaultFormat = "WebDeploy";
2828

29-
[Parameter(Position = 2, Mandatory = true, HelpMessage = "The file the publishing profile will we saved as")]
29+
[Parameter(Position = 2, Mandatory = false, HelpMessage = "The file the publishing profile will we saved as")]
3030
public string OutputFile { get; set; }
3131

3232
[Parameter(Position = 3, Mandatory = false, HelpMessage = "The format of the profile. Allowed values are [WebDeploy|FileZilla3|Ftp]. Default value is WebDeploy")]

src/ResourceManager/Websites/Commands.Websites/Utilities/WebsitesClient.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ public string GetWebAppPublishingProfile(string resourceGroupName, string webSit
263263
WrappedWebsitesClient.WebApps().ListSitePublishingProfileXmlSlot(resourceGroupName, webSiteName, options, slotName) :
264264
WrappedWebsitesClient.WebApps().ListSitePublishingProfileXml(resourceGroupName, webSiteName, options));
265265
var doc = XDocument.Load(publishingXml, LoadOptions.None);
266-
doc.Save(outputFile, SaveOptions.OmitDuplicateNamespaces);
266+
if (outputFile != null)
267+
doc.Save(outputFile, SaveOptions.OmitDuplicateNamespaces);
267268
return doc.ToString();
268269
}
269270

0 commit comments

Comments
 (0)