2016-08-04 51 views
0

如何在多部署插槽可用性中获取和过滤特定于Azure webapp的特定插槽的发布配置文件的值?来自powershell的Azure webapp的特定部署插槽的FTP配置文件

假设来自门户网站的默认FTP凭证看起来是生产实例,我不想将其包含在自动化电子邮件中。如何使用PowerShell。

+0

注:这是谁也需要一种方式来处理这种情况的任何用户共享。 –

回答

1

我们可以使用azure cmdlet Get-AzureRMWebAppSlotPublishingProfile来获取发布配置文件。

,我们可以得到这些细节,在以下情况下,定制开发插槽,如下图所示:

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

现在的输出似乎是以下格式:

<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 /> 

要过滤只有FTP主机,用户名和密码,我这样做(不确定是正确的方式,但我得到的细节过滤掉)

[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. 

希望这可以帮助别人,PowerShell的新手:)我一样