I was wondering if there is an easy way to completely copy all the key values from one web app's application settings to another, as seen in the below picture I have a lot of these key values and having to do this manually every time is very cumbersome.
With the release of Microsoft Azure PowerShell version 1.1. 0, a new option has been added to New-AzWebApp that lets you clone an existing App Service app to a newly created app in a different region or in the same region.
Azure App Service also supports deployments by using the Web Deploy technology. This approach is available with Visual Studio, WebMatrix, and Visual Studio Team Services. If you want to perform deployments by using Git or FTP, you must configure deployment credentials.
Azure runs App Services on a fully managed set of virtual machines in either a dedicated or shared mode, based on your App Service Plan. ... Web App – used for hosting websites and web applications (previously Azure Websites) API App – used for hosting the RESTful APIs. Not sure to understand the difference?
You can use Azure PowerShell. Here is a PowerShell Script for you.
try{
$acct = Get-AzureRmSubscription
}
catch{
Login-AzureRmAccount
}
$myResourceGroup = '<your resource group>'
$mySite = '<your web app>'
$myResourceGroup2 = '<another resource group>'
$mySite2 = '<another web app>'
$props = (Invoke-AzureRmResourceAction -ResourceGroupName $myResourceGroup `
-ResourceType Microsoft.Web/sites/Config -Name $mySite/appsettings `
-Action list -ApiVersion 2015-08-01 -Force).Properties
$hash = @{}
$props | Get-Member -MemberType NoteProperty | % { $hash[$_.Name] = $props.($_.Name) }
Set-AzureRMWebApp -ResourceGroupName $myResourceGroup2 `
-Name $mySite2 -AppSettings $hash
This script copy app settings from $mySite
to $mySite2
. If your web app involves with slot, for $props
, you should use the following command instead.
$props = (Invoke-AzureRmResourceAction -ResourceGroupName $myResourceGroup `
-ResourceType Microsoft.Web/sites/slots/Config -Name $mySite/$slot/appsettings `
-Action list -ApiVersion 2015-08-01 -Force).Properties
And, use Set-AzureRMWebAppSlot
instead of Set-AzureRMWebApp
Set-AzureRMWebAppSlot -ResourceGroupName $myResourceGroup2 `
-Name $mySite2 -Slot $slot -AppSettings $hash
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