How can I get PublishUrl through Azure PowerShell?

My goal is to transfer the name and location of the site and create a new site, get the appropriate credentials / URLs and deploy my site using WebDeploy.

I use the Azure Powershell Tools here: http://www.windowsazure.com/en-us/downloads/

I can create a new website using

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

In response to this, I get detailed information about the created site, including the publication username and password (PublishingUsername and PublishingPassword), one part of the information I do not receive is the publication URL (which I can get from the Azure Management Portal in the file XML format). In the XML file, this is the publishUrl attribute in the publishProfile node file.

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

This is a similar question that sounds like it is not yet possible, at least at the time of writing: How do I get the FTP URL for my Azure website through the management API?

+2
source share
2 answers

Get-AzureWebSite -Name SiteName

will return a 'git repository' url in it output


Get-AzureWebSite -Name SiteName

Real Estate = SelfLink

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

0
source

I got webpublish with this information:

 $websiteName = "mywebsite" #Get the website 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) 

Then I use this line to invoke the cmd script generated with the publish package.

+6
source

Source: https://habr.com/ru/post/1205968/


All Articles