I used to use Get-AzureWebsite -Name myportal
to get PublishingPassword
what I can use inside Visual Studio to publish the WebApp to the cloud.
But now I was assigned with a new azure subscription that is not seen with the old azure command set (i.e. Get-AzureSubscription
).
However this subscription is visible by Get-AzureRmSubscription
(with "Rm" keyword). But Get-AzureRmWebApp
doesn't contain PublishingPassword
property.
Is there any other way to get PublishingPassword
with new command set (that contains "Rm").
The cmdlet you are looking for is Get-AzureRmWebAppPublishingProfile
At the time I looked for a more direct method, but didn't turn one up. It is a little bit convoluted, but it works. (it doesn't actually write anything to file, but as I recall it choked if it wasn't included)
This is what I did with it...
function Get-FTPCredentials
{
$Xml = [xml](Get-AzureRmWebAppPublishingProfile -OutputFile test.xml -Format Ftp -ResourceGroupName $AppServiceResourceGroupName -Name $AppServiceWebAppName )
$PublishProfile = $Xml.FirstChild.ChildNodes[1]
Write-Output ("FTP location is - " + $PublishProfile.publishUrl)
Write-Output ("FTP username is - " + $PublishProfile.userName)
Write-Output ("FTP password is - " + $PublishProfile.userPWD)
Write-Output ("Website URL is - " + $PublishProfile.destinationAppUrl)
}
Quick flow to get publishing password (PublishingPassword
) for a website in Azure published via Visual Studio - manually by using PowerShell console:
Add-AzureRmAccount -TenantId 12343048-34cb-4322-b413-7b408837xxxx
Get-AzureRmWebAppPublishingProfile -Name myPortal -OutputFile test.xml -ResourceGroupName MyResourcesTestGroup
First command sets login to required tenant (directory) (i.e. adds your azure account to PowerShell session). Second gets the website (webapp) objects and prints publishing data including password.