microsoft/skills

azure-mgmt-apimanagement-py

用 Python 管理 APIM 服务、OpenAPI、后端与限流策略

  • SKILL.md 已保存
  • 中文用法已整理
  • 安装与运行未实测
先判断是否解决你的问题

azure-mgmt-apimanagement-py 是什么?

此 Skill 使用 azure-mgmt-apimanagement 管理 Azure APIM 资源:导入 API、配置产品/订阅、绑定 API、编写策略、管理 backend 与 named values。示例展示的是 ARM 管理操作,不是调用代理后的业务API。

中文说明由本站依据来源整理;英文原文保留在页面下方。

按客户端选择安装入口

怎么接入你的 Agent?

  1. 定位完整 Skill 目录

    打开本项目来源,核对 SKILL.md 及其引用的脚本和资料。

  2. 交给你正在用的 Agent

    在下面选择客户端,展开并复制安装指令,让 Agent 读取来源后选择安装方式。

  3. 确认识别,再做具体任务

    让 Agent 回报安装目录和识别到的名称 azure-mgmt-apimanagement-py,然后按本页使用示例提供材料。

展开并复制给 Codex 的安装指令
发送给 Codex

安装并检查 azure-mgmt-apimanagement-py

请在 Codex 的当前工作环境中安装并检查 azure-mgmt-apimanagement-py 这个 Skill。

项目身份:microsoft/skills / azure-mgmt-apimanagement-py
来源:https://github.com/microsoft/skills/blob/f03ec5392f7a0f3aca12af47477e92f1edf7b44c/.github/plugins/azure-sdk-python/skills/azure-mgmt-apimanagement-py/SKILL.md
已定位的源文件:.github/plugins/azure-sdk-python/skills/azure-mgmt-apimanagement-py/SKILL.md

1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。
准备输入,再按步骤执行

装好以后,具体怎么用?

准备哪些材料

  • 安装 azure-mgmt-apimanagement 和 azure-identity,准备 subscription/resource group/service 并取得 ARM 权限。
  • 已有可导入的 OpenAPI 文档、后端地址、目标产品和安全的配置管理途径。
  • 不要把真实后端 key 放代码或示例 NamedValue;先核对目标 APIM 实例、scope 和现有策略。

实际使用顺序

  1. 首先只读列出 service、API、产品并确认其名称和资源组。
  2. 导入 OpenAPI 时检查格式、版本、相对 path 和 backend service URL;示例 Petstore 只用于说明格式。
  3. 产品与 subscription 决定API访问关系;设置后检查订阅要求和审批策略。
  4. 编写 policy XML 前确认调用次数、周期、header和base策略的继承;named value 的 secret 值只能经安全渠道注入。
使用示例

从一个具体任务开始

本站根据源文件编写的使用示例,未在本站实际运行。示例中的文件由你提供。

安装并识别 Skill 后发送

复制一个具体任务

请用 azure-mgmt-apimanagement-py 为已存在测试APIM写只读盘点草案:列出API、产品和当前API policy的检查步骤;不要创建subscription、导出key或写入策略。
预期结果

得到资源盘点代码草案;未访问或更改APIM。

使用前先看这些限制

使用条件与边界

  • subscription.primary_key 是高敏感凭证,不能打印或写日志;源文该输出示例不可照搬到生产。
  • begin_create_or_update 等长操作创建/修改远端资源,异步轮询完成后仍需确认终态。
  • API import 成功不证明后端健康;应独立检查网关调用与运行时后端。
针对这个 Skill 的疑问

常见问题

怎么把OpenAPI挂到APIM?

管理面创建 API 时使用对应的 OpenAPI 格式和值,并配置网关 path 与实际 backend service URL;随后再配置产品和策略。

如何避免真实 key 被泄漏?

把密钥作为 secret named value 从 Key Vault 或受控配置注入;不在脚本参数、控制台打印、诊断日志或源码里留下明文。

需要核对时再展开原文

来源原文与资料状态

源文件
已保存 SKILL.md,抓取于 2026-11-16T12:36:35.145Z
中文使用说明
已针对下方源文件版本整理用途、用法和常见问题
安装与任务测试
本站未执行安装或任务测试
来源复核
本页中文用法已对照保存版本的完整 SKILL.md 阅读整理
展开 SKILL.md 原文、章节与历史收录资料

.github/plugins/azure-sdk-python/skills/azure-mgmt-apimanagement-py/SKILL.md · 抓取时间 2026-11-16T12:36:35.145Z

以下保留源文件的 description、章节及摘录,供核对中文说明;完整文件通过上方链接打开。

抓取成功不代表已完成安装或任务测试。

来源 description(原文)

Azure API Management SDK for Python. Use for managing APIM services, APIs, products, subscriptions, and policies. Triggers: "azure-mgmt-apimanagement", "ApiManagementClient", "APIM", "API gateway", "API Management".

查看源文件章节 / Source sections
  • 原文:Azure API Management SDK for Python
  • 安装 / Installation
  • 原文:Environment Variables
  • 原文:Authentication & Lifecycle
  • 原文:Create APIM Service
  • 原文:Import API from OpenAPI
  • 原文:Import API from URL
  • 原文:List APIs
  • 原文:Create Product
  • 原文:Add API to Product
  • 原文:Create Subscription
  • 原文:Set API Policy
  • 原文:Create Named Value (Secret)
  • 原文:Create Backend
  • 原文:Create User
  • 原文:Operation Groups
  • 原文:Best Practices
  • 原文:Reference Files
原文:Azure API Management SDK for Python

Manage Azure API Management services, APIs, products, and policies.

安装 / Installation

```bash pip install azure-mgmt-apimanagement pip install azure-identity ```

原文:Environment Variables

```bash AZURE_SUBSCRIPTION_ID=your-subscription-id # Required for all auth methods AZURE_TOKEN_CREDENTIALS=prod # Required only if DefaultAzureCredential is used in production ```

原文:Authentication & Lifecycle

> **🔑 Two rules apply to every code sample below:** > > 1. **Prefer `DefaultAzureCredential`.** It works locally (Azure CLI / VS Code / Developer CLI) and in Azure (managed identity, workload identity) with no code change. Avoid connection strings, account/API keys — they bypass Entra audit and rotation. > - Local dev: `DefaultAzureCredential` works as-is. > - Production: set `AZURE_TOKEN_CREDENTIALS=prod` (or `AZURE_TOKEN_CREDENTIALS=<specific_credential>`) to constrain the credential chain to production-safe credentials. > 2. **Wrap every client in a context manager** so HTTP transports, sockets, and token caches are released deterministically: > - Sync: `with <Client>(...) as client:` > - Async: `async with <Client>(...) as client:` **and** `async with DefaultAzureCredential() as credential:` (from `azure.identity.aio`) > > Snippets may abbreviate this setup, but production code should always follow both rules. ```python from azure.identity import DefaultAzureCredential from azure.mgmt.apimanagement import ApiManagementClient import os with ApiManagementClient( credential=DefaultAzureCredential(), subscription_id=os.environ["AZURE_SUBSCRIPTION_ID"] ) as client: # Use `client` for all subsequent operations (see examples below) ... ```

原文:Create APIM Service

```python from azure.mgmt.apimanagement.models import ( ApiManagementServiceResource, ApiManagementServiceSkuProperties, SkuType ) service = client.api_management_service.begin_create_or_update( resource_group_name="my-resource-group", service_name="my-apim", parameters=ApiManagementServiceResource( location="eastus", publisher_email="admin@example.com", publisher_name="My Organization", sku=ApiManagementServiceSkuProperties( name=SkuType.DEVELOPER, capacity=1 ) ) ).result() print(f"Created APIM: {service.name}") ```

原文:Import API from OpenAPI

```python from azure.mgmt.apimanagement.models import ( ApiCreateOrUpdateParameter, ContentFormat, Protocol ) api = client.api.begin_create_or_update( resource_group_name="my-resource-group", service_name="my-apim", api_id="my-api", parameters=ApiCreateOrUpdateParameter( display_name="My API", path="myapi", protocols=[Protocol.HTTPS], format=ContentFormat.OPENAPI_JSON, value='{"openapi": "3.0.0", "info": {"title": "My API", "version": "1.0"}, "paths": {"/health": {"get": {"responses": {"200": {"description": "OK"}}}}}}' ) ).result() print(f"Imported API: {api.display_name}") ```

文件 SHA256:f81c64f9313e75483ab37a657556eb9a9dfaa5c82d733e96bab7289ab78c4860

仓库许可证记录:MIT;skill-declaration-captured-not-interpreted,查看来源。

SKILL.md原文description · 2026-11-16T12:36:35.145Z

Azure API Management SDK for Python. Use for managing APIM services, APIs, products, subscriptions, and policies. Triggers: "azure-mgmt-apimanagement", "ApiManagementClient", "APIM", "API gateway", "API Management".

查看历史简介来源

历史收录数据

来源仓库microsoft/skills
Skill源路径.github/plugins/azure-sdk-python/skills/azure-mgmt-apimanagement-py/SKILL.md

安装前请让使用的Agent先读取这个SKILL.md及其所在目录,确认依赖和所需权限。此页不生成未经来源验证的安装命令。

返回 Skills 目录,按任务继续筛选 · MCP与Skills教程与资源