【发布时间】:2016-08-04 14:31:43
【问题描述】:
如何在多部署槽可用性中获取和过滤特定于 Azure webapp 特定槽的发布配置文件的值?
假设,来自门户的默认 FTP 凭据似乎是生产实例的,我不希望将其包含在自动化电子邮件中。如何使用powershell。
【问题讨论】:
-
注意:这是为任何需要处理这种情况的方法的用户共享的。
标签: azure ftp azure-powershell arm-template
如何在多部署槽可用性中获取和过滤特定于 Azure webapp 特定槽的发布配置文件的值?
假设,来自门户的默认 FTP 凭据似乎是生产实例的,我不希望将其包含在自动化电子邮件中。如何使用powershell。
【问题讨论】:
标签: azure ftp azure-powershell arm-template
我们可以使用 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 新手 :) 像我一样
【讨论】: