来自powershell的Azure webapp特定部署插槽的FTP配置文件

时间:2016-08-04 14:31:43

标签: azure ftp azure-powershell arm-template

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

比如说,门户网站的默认FTP凭据似乎是生产实例,我不想将其包含在自动化电子邮件中。如何使用powershell。

1 个答案:

答案 0 :(得分:2)

我们可以使用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.

希望这有助于某人,像我这样的新手:)

相关问题