简体   繁体   中英

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. 在此输入图像描述

The content of the file is something like shown below. 在此输入图像描述

Can someone please help me get this?

Thanks.

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:password@sitename.scm.azurewebsites.net"
  }
}

此外,要获取特定于部署槽的发布配置文件,我们可以使用

Get-AzureRMWebAppSlotPublishingProfile -ResourceGroupName Default-Web-EastUS -Name propertiesdemo -OutputFile none -Slot dev

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM