azure-resource-manager - 如何以编程方式创建 API 管理服务?

标签 azure-resource-manager azure-api-management

我正在尝试以编程方式(如果可能,通过 Azure 资源管理器)在特定资源组中创建 APIM 服务。目标是我们可以拥有一个参数化的模板或脚本,并且可以 checkin 源代码管理,以便我们可以复制和重新创建我们的环境。

This table在 ARM 文档页面中说,已为 APIM 启用资源管理器,但是 Quickstart Templates link找不到 Microsoft.ApiManagement 资源类型的示例模板。然而,这可能仅仅意味着还没有人向图库贡献模板,我必须自己编写。

至于编写我自己的 ARM 模板,article that walks you through authoring a Resource Manager template说:

To learn much of what you need to know about resource providers, see Resource Manager providers, regions, API versions and schemas

... 它链接回与我上面的“此表”文本相同的页面。 “创作模板”文章的同一部分还说:

[Properties are] Resource specific configuration settings. The values for the properties are exactly the same as the values you provide in the request body for the REST API operation (PUT method) to create the resource. For links to resource schema documentation or REST API, see Resource Manager providers, regions, API versions and schemas.

...再次链接回与上面相同的页面。

我已经检查了 APIM REST APIazure-resource-manager-schemas有关如何创建 APIM 实例的文档的页面。

  • APIM REST API 要求您已经创建了一个 APIM 实例。它设计用于在 APIM 实例中操作 APIM 资源,而不是首先创建 APIM 实例。
  • ARM 模式项目不包含 Microsoft.ApiManagement 的模式。字符串“api management”和“apim”未出现在模式项目中。

是否可以通过编程方式创建 API 管理服务,如果可以,如何创建?

最佳答案

是的,可以使用 Azure Powershell 1.0 命令行开关以编程方式创建 ApiManagement 服务 https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/ .以下是可帮助您实现它的命令行开关。

PS C:\WINDOWS\system32> get-help New-AzureRmApiManagement -example

NAME
New-AzureRmApiManagement

SYNOPSIS
Creates an API Management deployment.

SYNTAX
New-AzureRmApiManagement [-Capacity [<Int32>]] [-Sku [<PsApiManagementSku>]] [-Tags [<0, Culture=neutral,
PublicKeyToken=b77a5c561934e089>]] -AdminEmail <String> -Location {North Central US | South Central US | Central
US | West Europe | North Europe | West US | East US | East US 2 | Japan East | Japan West | Brazil South |
Southeast Asia | East Asia | Australia East | Australia Southeast} -Name <String> -Organization <String>
-ResourceGroupName <String> [<CommonParameters>]

Example 1: Create at Developer tier API Management service

PS C:\>New-AzureRmApiManagement -ResourceGroupName "ContosoGroup02" -Name "ContosoApi" -Location "Central US"
-Organization "Contoso" -AdminEmail "admin@contoso.com"


This command creates a Developer tier API Management service. The command specifies the organization and the
administrator address. The command does not specify the SKU parameter. Therefore, the cmdlet uses the default
value of Developer.


Example 2: Create a Standard tier service that has three units

PS C:\>New-AzureRmApiManagement -ResourceGroupName "ContosoGroup02 -Name "ContosoApi" -Location "Central US"
-Organization "Contoso" -AdminEmail "admin@contoso.com" -Sku Standard -Capacity 3


This command creates a Standard tier API Management service that has three units.

您可以使用以下命令找到其他命令行开关

 get-Help AzureRmApiManagement

可在此处找到 commandlet 的完整文档 https://msdn.microsoft.com/en-us/library/mt619282.aspx

关于azure-resource-manager - 如何以编程方式创建 API 管理服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35421629/

相关文章:

azure - 导出 Azure Web 应用程序的 AppSettings 的简单方法?

用于 Azure 资源运行状况的 Azure 资源管理 REST API

azure - ARM模板-网站部署失败

azure ARm 模板 - 无法将 AD 应用程序注册与功能应用程序关联

azure - 将某些 Controller 的访问限制为仅限 Azure APIM

azure-api-management - 如何提取发送请求策略的响应状态码

azure - 通过 ARM 模板将读取器角色分配给存储帐户时遇到问题

Azure API 管理主动使缓存失效并刷新

azure - APIM : Limit concurrent open websocket connections

Azure API 管理不验证证书链