Azure CLI-用于设置API管理自定义域的Bash脚本
我正在尝试使用bash脚本在api管理中设置一个自定义域。我知道可以使用powershell来完成Azure CLI-用于设置API管理自定义域的Bash脚本,bash,azure-cli,Bash,Azure Cli,我正在尝试使用bash脚本在api管理中设置一个自定义域。我知道可以使用powershell来完成 # Upload the custom ssl certificate to be applied to Proxy endpoint / Api Gateway endpoint $proxyCertUploadResult = Import-AzApiManagementHostnameCertificate -Name $apimServiceName - ResourceGroupNam
# Upload the custom ssl certificate to be applied to Proxy endpoint / Api Gateway endpoint
$proxyCertUploadResult = Import-AzApiManagementHostnameCertificate -Name $apimServiceName -
ResourceGroupName $resourceGroupName -HostnameType "Proxy" -PfxPath $proxyCertificatePath -
PfxPassword $proxyCertificatePassword
# Upload the custom ssl certificate to be applied to Portal endpoint
$portalCertUploadResult = Import-AzApiManagementHostnameCertificate -Name $apimServiceName -
ResourceGroupName $resourceGroupName -HostnameType "Portal" -PfxPath $portalCertificatePath -
PfxPassword $portalCertificatePassword
# Create the HostnameConfiguration object for Portal endpoint
$PortalHostnameConf = New-AzApiManagementHostnameConfiguration -Hostname $proxyHostname -
CertificateThumbprint $proxyCertUploadResult.Thumbprint
# Create the HostnameConfiguration object for Proxy endpoint
$ProxyHostnameConf = New-AzApiManagementHostnameConfiguration -Hostname $portalHostname -
CertificateThumbprint $portalCertUploadResult.Thumbprint
# Apply the configuration to API Management
Set-AzApiManagementHostnames -Name $apimServiceName -ResourceGroupName $resourceGroupName `
-PortalHostnameConfiguration $PortalHostnameConf -ProxyHostnameConfiguration $ProxyHostnameConf
是否可以使用bash执行类似的操作?如果要使用Azure CLI为Azure API管理配置自定义域,我们可以使用命令
az-apim update--set-hostnameConfigurations={setting}
。
hostnameConfigurations设置应该如下
[{
"hostName": "bbb.beesphotos.net",
"type": "Portal",
"certificate": null,
"certificatePassword": "<pfx file passsword>",
"encodedCertificate": "Base64 Encoded certificate content"
}, {
"hostName": "huryapim.azure-api.net",
"type": "Proxy",
"certificate": null,
"defaultSslBinding": true,
"negotiateClientCertificate": false
}
]
[{
“主机名”:“bbb.beesphotos.net”,
“类型”:“门户”,
“证书”:空,
“证书密码”:“,
“encodedCertificate”:“Base64编码证书内容”
}, {
“主机名”:“huryapim.azure api.net”,
“类型”:“代理”,
“证书”:空,
“defaultSslBinding”:正确,
“negotiateClientCertificate”:false
}
]
如果要使用Azure CLI为Azure API管理配置自定义域,我们可以使用命令
az-apim-update--set-hostnameConfigurations={setting}
。
hostnameConfigurations设置应该如下
[{
"hostName": "bbb.beesphotos.net",
"type": "Portal",
"certificate": null,
"certificatePassword": "<pfx file passsword>",
"encodedCertificate": "Base64 Encoded certificate content"
}, {
"hostName": "huryapim.azure-api.net",
"type": "Proxy",
"certificate": null,
"defaultSslBinding": true,
"negotiateClientCertificate": false
}
]
[{
“主机名”:“bbb.beesphotos.net”,
“类型”:“门户”,
“证书”:空,
“证书密码”:“,
“encodedCertificate”:“Base64编码证书内容”
}, {
“主机名”:“huryapim.azure api.net”,
“类型”:“代理”,
“证书”:空,
“defaultSslBinding”:正确,
“negotiateClientCertificate”:false
}
]
您可以使用以下方法:
az apim update --resource-group $rgName --name $apiMgmtName `
--add hostnameConfigurations type=Proxy host_name=$hostName `
encodedCertificate=$certData certificatePassword=$certPassword `
negotiateClientCertificate=false
您可以使用以下方法:
az apim update --resource-group $rgName --name $apiMgmtName `
--add hostnameConfigurations type=Proxy host_name=$hostName `
encodedCertificate=$certData certificatePassword=$certPassword `
negotiateClientCertificate=false
我可能没有正确的语法,但当我运行az apim更新--name myapim--资源组MyRG--set hostnameConfigurations={[{“hostName”:“bbb.hostName.com.au”,“type”:“Proxy”,“keyVaultId”:“,”defaultSslBinding:”true,“negotiateClientCertificate”:true}]}我收到以下错误-在“bbb.hostname”中找不到“bbb”。请尝试通过将json转换为字符串。然后再次运行。我可能没有正确的语法,但当我运行az apim更新--name myapim--resource group MyRG--set hostnameConfigurations={[{“hostName”:“bbb.hostName.com.au”,“type”:“Proxy”,“keyVaultId”:“,“defaultSslBinding”:true,“negotiateClientCertificate”:true}]}我收到以下错误-在“bbb.hostname”中找不到“bbb”。请尝试通过将json转换为字符串。然后再跑。