Does anyone know how to import a csv file into Azure app settings (web staging) using powershell?
这是我正在使用的代码。它在实时插槽上正常运行,但在暂存插槽上无效。
1 2 3 4 5 6 7 8 9 10 11 | $csv ="C:\\WorkDir\\web-app-settings.csv" $appSettingsList = Import-Csv $csv $resourcegroupname ="DevOp-Test-RG" $name ="web-uks-staging" $appSettingsHash = @{} Write-Host"current app settings" -foreground yellow; ForEach ($kvp in $appSettingsList) { $appSettingsHash[$kvp.Key] = $kvp.Value write-host $kvp.Key":" $kvp.Value -foreground green; Set-AzureRMWebApp -ResourceGroupName $resourcegroupname -Name $name -AppSettings $appSettingsHash |
在powershell中弹出的错误是" Set-AzureRMWebApp:资源下的资源'Microsoft.Web / sites / web-uks-staging'
找不到组" DevOp-Test-RG"。"
我非常感谢您的帮助。非常感谢。
您应使用
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | $csv ="d:\\webapp.csv" $appSettingsList = Import-Csv $csv $resourcegroupname ="shuiapp" $appname="shuicli" $soltname ="shuisolt" $appSettingsHash = @{} Write-Host"current app settings" -foreground yellow; ForEach ($kvp in $appSettingsList) { $appSettingsHash[$kvp.Key] = $kvp.Value write-host $kvp.Key":" $kvp.Value -foreground green; Set-AzureRmWebAppSlot -ResourceGroupName $resourcegroupname -Name $appname -Slot $soltname -AppSettings $appSettingsHash } |