2014-02-19 46 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脚本。

相关问题