Adding app setting to existed app settings in web app

Govindagoud patil 21 Reputation points

In order to add extra app setting to web app via powershell is there any way to added app setting without pulling down existed app setting and adding new one then updating back to web app.

I want to simply add new one as we do in portal via powershell.

Is there any other than below

$webapp=Get-AzWebApp -ResourceGroupName $resourceGroupName  -Name $appName

$newAppSettings = @{}
ForEach ($item in $appSettings) {
$newAppSettings[$item.Name] = $item.Value

$newAppSettings['WEBSITE_RUN_FROM_PACKAGE'] = $urlToAppbinary

Set-AzWebApp -ResourceGroupName $resourceGroupName -Name $appName  -AppSettings $newAppSettings
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,142 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 26,771 Reputation points Microsoft Employee

    Hi @Govindagoud patil ,

    The -AppSettings switch for PSSite works as a replace. Therefore, your above script is the proper way to add a setting. If you're doing this often, I would suggest converting into a custom cmdlet or function.

    You can also submit feedback or create a new issue on the powershell github asking to create additional switches that will allow setting a specific value in the Hashtable.

    1 person found this answer helpful.
    0 comments No comments