powershell update AppSettings

kumar 41 Reputation points
2022-01-11T06:08:19.48+00:00

I'm trying use below script to update the configuration settings. The script is getting executed successfully but the the new key values are not getting updated. Can you please help me

https://learn.microsoft.com/en-us/answers/questions/1564/adding-app-setting-to-existed-app-settings-in-web.html

Thanks

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,523 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,761 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andriy Bilous 11,421 Reputation points MVP
    2022-01-15T09:57:02.5+00:00

    Hello @kumar

    I used the script from your link and it is working as a charm.

    Here are my steps:

    • I added new AppSetting in my WebApp test1 = 2
      165326-image.png
    • I run the below script
        $webapp=Get-AzWebApp -ResourceGroupName test-rg  -Name testwabpp  
        $appSettings=$webapp.SiteConfig.AppSettings  
        $newAppSettings = @{}  
        ForEach ($item in $appSettings) {  
            $newAppSettings[$item.Name] = $item.Value  
        }  
        $newAppSettings['test1'] = "1"  
        Set-AzWebApp -ResourceGroupName test-rg  -Name testwabpp -AppSettings $newAppSettings  
      
    • App Setting test1 value is changed to 1
      165346-image.png
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.