0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Azure Portal をAI操作 - Azure MCP

Last updated at Posted at 2025-07-23

概要

(自分メモ)
Gemini CLIAzure MCPを組み込みCosmosDBを操縦したい。

関連記事リンク: Azure Development

環境

設定

~/.gemini/settings.json
{
    "mcpServers": {
        "azure-mcp": {
            "command": "npx",
            "args": ["-y", "@azure/mcp@latest","server","start"]
        },
        // Cosmos DB for MongoDB APIを操作する場合
        "mongodb": {
            "command": "npx",
            "args": [
                "-y", "mongodb-mcp-server",
                "--connectionString",
                "※",
                "--readOnly"
            ]
        }
    }
}

※: Home > CosmonsDBリソース > 接続文字列 > PRIMARY CONNECTION STRING を採取

起動

使用例

Function操作
> リソースグループRG1のFunctionを列挙

// snip..
✦ リソースグループ RG1 に存在するAzure Functionアプリは以下の通りです。
 - func1
 - ....

実行中にサブスクリプションIDを聞かれる、 Home > サブスクリプション > サブスクリプションID の値を入力

APIM操作1
> func1を収容するAPIMからopenapi定義を採取

// snip..
✦ func1 Function App に対応する api の OpenAPI 定義を取得しました。
  この定義には、以下のエンドポイントが含まれています。

   * /account/login (POST): ログインユーザーのJWTトークンを取得します。
   * /account/logout (POST): ログインユーザーのJWTトークンを無効化します。
   * 
APIM操作2
> '/account/login'のクエリサンプル

// snip..
    1 {
    2   "id": "userid",
    3   "password": "secret***"
    4 }
CosmosDB操作
> mongodb:db1 の collection1コレクションからtype=humanをカウント

// snip..

参照

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?