mar*_*101 2 azure-web-sites azure-powershell
我的目标是能够传入站点名称和位置并创建新站点,检索相应的凭据/ URL并使用WebDeploy部署我的站点.
我从这里使用Azure Powershell Tools:http://www.windowsazure.com/en-us/downloads/
我可以创建一个新的网站
New-AzureWebsite -Name site-name -Location "West US"
Run Code Online (Sandbox Code Playgroud)
为了响应这一点,我获得了有关创建的网站的详细信息,包括发布用户名和密码(PublishingUsername和PublishingPassword),我需要的一条信息是我需要的是发布URL(我可以从Azure管理门户网站检索)在XML格式的文件中).在XML文件中,它是publishProfile节点上的publishUrl属性.
我的问题是,有没有办法通过PowerShell获取发布URL,或通过REST API,但我更喜欢PowerShell.
这是一个类似的问题,听起来似乎尚不可能,至少在撰写本文时:如何通过Management API获取Azure网站的FTP URL?
我用这些信息实现了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)
Run Code Online (Sandbox Code Playgroud)
然后我使用此行来调用使用发布包生成的cmd脚本.
| 归档时间: |
|
| 查看次数: |
1394 次 |
| 最近记录: |