2

My goal is to be able to pass in a site name and location and have a new site created, retrieve the appropriate credentials/URLs and deploy my site with WebDeploy.

I'm using the Azure Powershell Tools from here: http://www.windowsazure.com/en-us/downloads/

I am able to create a new website with

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

In response to this I get details about the created site, including the publishing username and password (PublishingUsername and PublishingPassword), the one piece of information I do not get that I need is the publishing URL (which I can retrieve from the Azure Management portal in an XML formatted file). In the XML file it is the publishUrl attribute on the publishProfile node.

My question is, is there a way via PowerShell to get the publishing URL, or via the REST API, but I would prefer PowerShell.

This is a similar question, which sounds like its not yet possible, at least at the time of writing: How can I get the FTP URL for my Azure website via the Management API?

Community
  • 1
  • 1
markus101
  • 338
  • 3
  • 5
  • 12

2 Answers2

6

I achieved webpublish with these information :

$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)

I then use this line to call the cmd script generated with the publish package.

Johnny5
  • 6,664
  • 3
  • 45
  • 78
0

Get-AzureWebSite -Name site-name

will return the 'Git Repository' url in it's output


Get-AzureWebSite -Name site-name

Property=SelfLink

If you take the host name and replace api with publish you have the publishing url. Keep in mind that the publishing url is a secure connection so it connects over port 443

cory-fowler
  • 4,020
  • 2
  • 18
  • 29
  • 1
    I need the URL to use for web deploy not git. Thanks though. – markus101 Feb 20 '14 at 21:46
  • there is a github issue for this (https://github.com/WindowsAzure/azure-sdk-tools/issues/1879) feel free to contact the powershell guys about this but I believe for now you will have to call the rest API if you wanna get the ftp publish url. Another option will be to build it yourself based on the stamp url – ahmelsayed Feb 22 '14 at 04:09
  • As ahmel mentions above, this edit would be building it yourself with the stamp url – cory-fowler Feb 24 '14 at 00:21
  • I had considered using the SelfLink as well, at this point its probably the best choice for my scenario. Thanks. – markus101 Feb 24 '14 at 23:27