How can we get the PublishProfile for an Azure WebApp using Powershell?
I'm not looking for Get-AzurePublishSettingsFile
cmdlet. That gives me the PublishSettings for the whole subscription.
I want the PublishSettings only for that particular Azure WebApp.
We can get this file when we click the following link on Azure Portal.
The content of the file is something like shown below.
Can someone please help me get this?
Thanks.
Azure Cloud Shell – Azure PowerShell Open Cloud Shell directly form the Azure Portal, or go to https://shell.azure.com (logon with your cloud credentials). To list the subscription ID, subscription name, and tenant ID for all subscriptions that the logged-on account can access, use the Get-AzSubscription cmdlet.
A web browser opens at https://go.microsoft.com/fwlink/?LinkID=294709. When prompted, download and save the publishing settings file as a . publishsettings type file to your computer.
Actually, we have a new PowerShell command:
Get-AzureRMWebAppPublishingProfile -ResourceGroupName myRG -Name webAppName
That will give you the PublishProfile in a single command!
You can get the publishing credentials for your site using the ResourceManager cmdlets as follows:
# List publishingcredentials
$resource = Invoke-AzureRmResourceAction -ResourceGroupName <Resource Group Name> -ResourceType Microsoft.Web/sites/config -ResourceName <Site Name>/publishingcredentials -Action list -ApiVersion 2015-08-01 -Force
$resource.Properties
This returns a JSON blob with the same information as the publish profile:
{
"id": "/subscriptions/subid/resourceGroups/rgname/providers/Microsoft.Web/sites/sitename/publishingcredentials/$sitename",
"name": "sitename",
"type": "Microsoft.Web/sites/publishingcredentials",
"location": "West US",
"tags": {
"hidden-related:/subscriptions/subid/resourcegroups/adriang-test/providers/Microsoft.Web/serverfarms/serverfarmname": "empty"
},
"properties": {
"name": null,
"publishingUserName": "$sitename",
"publishingPassword": "password",
"metadata": null,
"isDeleted": false,
"scmUri": "https://$sitename:[email protected]"
}
}
Also, to fetch the publishing profile specific to a deployment slot , we could use
Get-AzureRMWebAppSlotPublishingProfile -ResourceGroupName Default-Web-EastUS -Name propertiesdemo -OutputFile none -Slot dev
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With