【问题标题】:Az Command powershell for adding urls in CORS of azure app serviceAz Command powershell 用于在 azure app 服务的 CORS 中添加 url
【发布时间】:2020-07-29 15:16:00
【问题描述】:

我正在寻找 az commands (powershell) 以在部署时在 azure app 服务中添加 url

为了清楚起见,您可以参考所附图片 .

提前致谢

【问题讨论】:

    标签: azure powershell azure-web-app-service az


    【解决方案1】:

    请使用Set-AzResource

    一个例子供你参考。

    $webAppName = ""
    $subscriptionId = ""
    $tenantId = ""
    $resourceGroup = ""
    
    Connect-AzAccount -Tenant $tenantId
    Select-AzSubscription -SubscriptionId $subscriptionId
    
    $allowedOrigins = @()
    $allowedOrigins += "www.example.com"
    
    $PropertiesObject = @{cors = @{allowedOrigins= $allowedOrigins}}
    
    Set-AzResource -PropertyObject $PropertiesObject -ResourceGroupName $resourceGroup -ResourceType Microsoft.Web/sites/config -ResourceName $webAppName/web -ApiVersion 2015-08-01 -Force
    

    【讨论】:

    • 感谢您的回复,我们没有使用 CLI,我正在使用 azure powershell Az modules 命令进行部署
    • 嘿,你能告诉我如何为特定插槽添加 cors url
    猜你喜欢
    • 2018-12-28
    • 1970-01-01
    • 2021-11-27
    • 1970-01-01
    • 2023-03-15
    • 2020-10-19
    • 2019-07-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多