2016-08-04 50 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的新手:)我一樣