Azure Powershell集合Cors允许的来源
我想通过Powershell为WebApp设置Cors allowedOrigins选项,但无法使其工作 有人能帮忙吗 这里是我的脚本,但没有工作Azure Powershell集合Cors允许的来源,powershell,azure,continuous-integration,azure-web-app-service,Powershell,Azure,Continuous Integration,Azure Web App Service,我想通过Powershell为WebApp设置Cors allowedOrigins选项,但无法使其工作 有人能帮忙吗 这里是我的脚本,但没有工作 $Resource = Get-AzureRmResource -ResourceType Microsoft.Web/sites/config -ResourceGroupName "####" -ResourceName "####" -ApiVersion 2015-08-01 $Resource.Properties.cors = @{al
$Resource = Get-AzureRmResource -ResourceType Microsoft.Web/sites/config -ResourceGroupName "####" -ResourceName "####" -ApiVersion 2015-08-01
$Resource.Properties.cors = @{allowedOrigins = "*"}
$Resource.Properties.cors.allowedOrigins = "*"
$Resource | Set-AzureRmResource -ApiVersion 2015-08-01 -Force
我找到了解决办法
解决办法是
$Resource.Properties.cors = @{allowedOrigins = @("http://example.net")}
我找到了解决办法
解决办法是
$Resource.Properties.cors = @{allowedOrigins = @("http://example.net")}
博客中提供的脚本可用于此目的:
$webAppName = "powershelldemowebapp"
$subscriptionId = "xxxx-xxxx-xxx-xxxx-xxxx-xxxx-xxx"
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId $subscriptionId
$rgName = GetResourceGroupForWebApp $webAppName
$allowedOrigins = @()
$allowedOrigins += "*"
$allowedOrigins += "www.yourdomain.com"
$PropertiesObject = @{cors = @{allowedOrigins= $allowedOrigins}}
Set-AzureRmResource -PropertyObject $PropertiesObject -ResourceGroupName $rgName -ResourceType Microsoft.Web/sites/config -ResourceName $webAppName/web -ApiVersion 2015-08-01 -Force
博客中提供的脚本可用于此目的:
$webAppName = "powershelldemowebapp"
$subscriptionId = "xxxx-xxxx-xxx-xxxx-xxxx-xxxx-xxx"
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId $subscriptionId
$rgName = GetResourceGroupForWebApp $webAppName
$allowedOrigins = @()
$allowedOrigins += "*"
$allowedOrigins += "www.yourdomain.com"
$PropertiesObject = @{cors = @{allowedOrigins= $allowedOrigins}}
Set-AzureRmResource -PropertyObject $PropertiesObject -ResourceGroupName $rgName -ResourceType Microsoft.Web/sites/config -ResourceName $webAppName/web -ApiVersion 2015-08-01 -Force
对于较新的Azure Powershell,请使用
Set AzureRmResource
而不是Set AzureRmResource
对于较新的Azure Powershell,请使用Set AzureRmResource
而不是Set AzureRmResource