Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get PublishProfile for an Azure WebApp using Powershell

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. enter image description here

The content of the file is something like shown below. enter image description here

Can someone please help me get this?

Thanks.

like image 758
RKS Avatar asked Jan 28 '16 16:01

RKS


People also ask

How do I get Azure subscription details using PowerShell?

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.

How do you get Azure publish settings file?

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.


3 Answers

Actually, we have a new PowerShell command:

Get-AzureRMWebAppPublishingProfile -ResourceGroupName myRG -Name webAppName

That will give you the PublishProfile in a single command!

like image 97
Ahmed Elnably Avatar answered Oct 12 '22 10:10

Ahmed Elnably


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]"
  }
}
like image 7
theadriangreen Avatar answered Oct 12 '22 11:10

theadriangreen


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
like image 2
H Bala Avatar answered Oct 12 '22 09:10

H Bala