0
votes

How to fetch and filter the values specific to publishing profile for a specific slot of Azure webapp, in a multi deployment slot availability?

Say, the default FTP credentials from portal appear to be of the production instance, which I didn't prefer to include in the automation email. How to using powershell.

1
Note: This is shared for any user who would require a way to handle this scenario.H Bala

1 Answers

2
votes

We could use the azure cmdlet Get-AzureRMWebAppSlotPublishingProfile to get the publishing profile.

We could get these details, in below case for custom dev slot, as below:

Get-AzureRMWebAppSlotPublishingProfile -ResourceGroupName Default-Web-EastUS -Name propertiesdemo -OutputFile none -Slot dev

Now the output appears to be in following format:

<publishData>  <publishProfile profileName="priesdemo-dev - Web Deploy" publishMethod="MSDeploy" publishUrl="priesdemo-dev.scm.azurewebsites.net:443" msdeploySite="propertiesdemo__dev"
 userName="$priesdemo__dev" userPWD="{Your profile password}" destinationAppUrl="http://priesdemo-dev.azurewebsites.net" SQLServerDBCo
nnectionString="" mySQLDBConnectionString="" hostingProviderForumLink="" controlPanelLink="http://windows.azure.com" webSystem="WebSites">
<databases />
 </publishProfile>
 <publishProfile profileName="propertiesdemo-dev - FTP" publishMethod="FTP" publishUrl="ftp://waws-prod-blu-023.ftp.azurewebsites.windows.net/site/wwwroot" ftpPassiveMode="True" us
erName="priesdemo__dev\$priesdemo__dev" userPWD="{Your passwrod here}" destinationAppUrl="http://priesdemo-dev.azurewebsites.n
et" SQLServerDBConnectionString="" mySQLDBConnectionString="" hostingProviderForumLink="" controlPanelLink="http://windows.azure.com" webSystem="WebSites">
<databases />

To Filter only the ftp host, username and password, I did this way ( not sure is the right way but I get the details filtered out )

[xml]$azureSlotProfile = Get-AzureRMWebAppSlotPublishingProfile -ResourceGroupName Default-Web-EastUS -Name priesdemo -OutputFile none -Slot dev
$azureSlotProfile.GetType().FullName

$ftpprofile = $azureSlotProfile.publishData.publishProfile | Where-Object publishMethod -EQ "FTP" | SELECT userName,userPWD,publishUrl
$ftpprofile.publishUrl #this shows host ftp value.

Hope this helps someone , powershell newbie :) like me