Azure API 管理 - 如何通过 PowerShell 命令启用 HTTP/2?

Azure API Management - how to enable HTTP/2 via PowerShell command?

我正在寻找正确的 PowerShell 语法来为 Azure API 管理实例启用 HTTP/2 设置。

我假设 this (New-AzApiManagementSslSetting) 一个,但是

a) 确切的语法是什么

b) 我是否也可以为现有实例启用它(就像您在门户中所做的那样)?

所以,您想要将 http2 分配给 front/backend vs 在 ServerProtocol 上,如文档中所示? --- 你为什么不只是做...

$enableHttp2 = @{'Http2' = 'True'}

连同 Mohammad 已经向您指出的内容,其中显示了 -ServerProtocol parameter...

上的 Http2 设置

-ServerProtocol Server protocol settings like Http2. This parameter is optional.

Type: Hashtable Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False

the settings docs, specifically say ...

已更新 cmdlet New-AzApiManagement 以管理 ApiManagement 服务 添加了对新 'Consumption' SKU 的支持 添加了为 'Consumption' SKU

打开 'EnableClientCertificate' 标志的支持

新的 cmdlet New-AzApiManagementSslSetting 允许配置 'TLS/SSL' 'Backend' 和 'Frontend' 上的设置。

这也可用于在 'Frontend' 上配置 'Ciphers' 像 '3DES' 和 'ServerProtocols' 像 'Http2' ApiManagement 服务。

添加了对在 ApiManagement 服务上配置 'DeveloperPortal' 主机名的支持。 更新了 cmdlet Get-AzApiManagementSsoToken 以将 'PsApiManagement' 对象作为输入

出于某种原因,PowerShell 命令对我不起作用,所以我使用 bash(和 jq)来执行此操作。先修改customProperties,存入变量:

customPropertiesNew=$(az apim show -n $APIM_NAME -g $APIM_RG --query customProperties | jq '."Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2" = "True"')

然后应用修改后的自定义属性(此步骤可能需要 7-14 分钟!):

az apim update -n $APIM_NAME -g $APIM_RG --set customProperties="$customPropertiesNew"