相关疑难解决方法(0)

使用Azure Power Shell将应用程序设置添加到现有Azure Web应用程序

我想编写一个使用azure power shell运行的脚本来自动添加Web应用程序配置

Azure> MyWebApp>应用程序设置>应用程序设置

它看起来像key ="value"

我写这个脚本

###########################
# MyApp Config Automation #
###########################

#Begin

$subscriptionName="MySubscriptionName"
$webSiteName="MyWebAppName"
$storageAccountName="StorageAccountName"
########################################
$userName = "myaccount@outlook.com"
$securePassword = ConvertTo-SecureString -String "mypass" -AsPlainText -Force
#####################################
$cred = New-Object System.Management.Automation.PSCredential($userName, $securePassword)
#####################################
Add-AzureAccount -Credential $cred 
Select-AzureSubscription -SubscriptionName $subscriptionName -Default
#####################################
Get-AzureWebsite -Name $webSiteName

#End
Run Code Online (Sandbox Code Playgroud)

但我知道上面的脚本只是获取我的Web应用程序,现在我需要访问MyWebApp>应用程序设置>应用程序设置并给出我的新应用程序设置的脚本文件/数组,并检查脚本是否有任何新的应用程序设置键它会将它添加到App Settings,如果有任何现有的键,它将覆盖它的值.什么是步骤或APIS或我能用天蓝色电源壳做到这一点?

编辑:此脚本可以自动创建新的Web应用程序并向其添加应用程序设置:

##############################################
# Creating website and Adding Configs Script #
##############################################

$webSiteName="mywebsite"
$storageAccountName="storageaccount"
$subscriptionName="mysubsc"
$userName = "myaccount"
$securePassword = ConvertTo-SecureString -String "mypass" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($userName, $securePassword) …
Run Code Online (Sandbox Code Playgroud)

powershell azure azure-powershell

35
推荐指数
3
解决办法
2万
查看次数

标签 统计

azure ×1

azure-powershell ×1

powershell ×1