2014-02-19 49 views
2

我的目標是能夠傳遞站點名稱和位置並創建新站點,檢索相應的憑據/ URL並使用WebDeploy部署我的站點。如何通過Azure PowerShell獲取PublishUrl?

我使用的是從這裏在Azure PowerShell的工具:http://www.windowsazure.com/en-us/downloads/

我能夠創建

New-AzureWebsite -Name site-name -Location "West US" 

一個新的網站針對這一點,我得到的信息有關創建的網站,其中包括髮布用戶名和密碼(PublishingUsername和PublishingPassword),我沒有得到我需要的一條信息是發佈URL(我可以從Azure管理門戶以XML格式的文件檢索)。在XML文件中,它是publishProfile節點上的publishUrl屬性。

我的問題是,有沒有辦法通過PowerShell獲取發佈URL或通過REST API,但我更喜歡PowerShell。

這是一個類似的問題,這聽起來像它沒有可能的,至少在寫作的時候:How can I get the FTP URL for my Azure website via the Management API?

回答

0

GET-AzureWebSite -Name站點名稱

將返回「Git倉庫」網址在它的輸出


獲取-AzureWebSite -Name站點名稱

屬性= SelfLink

如果您將主機名稱替換爲apipublish,則表示您有發佈網址。請記住,在發佈網址是一個安全的連接,因此它連接了port 443

+1

我需要這個URL來用於web部署而不是git。不過謝謝。 – markus101

+0

有一個Github的問題(https://github.com/WindowsAzure/azure-sdk-tools/issues/1879)隨時聯繫PowerShell的人,但我相信現在你將不得不打電話給其他人API如果你想獲得ftp發佈網址。另一個選擇是根據郵票url自己構建 – ahmelsayed

+0

正如上面提到的那樣,這個編輯會自己用印章url –

6

我取得了這些信息webpublish:

$websiteName = "mywebsite" 

#Get the website's propeties. 
$website = Get-AzureWebSite -Name $webSiteName 
$siteProperties = $website.SiteProperties.Properties 

#extract url, username and password 
$url = ($siteProperties | ?{ $_.Name -eq "RepositoryURI" }).Value.ToString() + "/MsDeploy.axd" 
$userName = ($siteProperties | ?{ $_.Name -eq "PublishingUsername" }).Value 
$pw = ($siteProperties | ?{ $_.Name -eq "PublishingPassword" }).Value 

#build the command line argument for the deploy.cmd : 
$argFormat = ' /y /m:"{0}" -allowUntrusted /u:"{1}" /p:"{2}" /a:Basic "-setParam:name=DeployIisAppPath,value={3}"' 
$arguments = [string]::Format($argFormat, $url, $userName, $pw, $webSiteName) 

我使用此行來調用與發佈程序包生成的CMD腳本。

相關問題