azure-openai
Azureのインフラ上でOpenAIモデル(GPT-4oなど)を利用し、企業コンプライアンスやセキュリティ要件を満たしながら、コンテンツフィルタリングやVNET分離された環境でOpenAIのAPIを活用するSkill。
📜 元の英語説明(参考)
Azure OpenAI Service — OpenAI models (GPT-4o, DALL-E 3, Whisper) on Azure infrastructure. Use when deploying OpenAI models with enterprise compliance (GDPR, HIPAA, SOC2), Azure-native auth via Managed Identity, content filtering, or VNET-isolated deployments. Same OpenAI API, hosted on Azure.
🇯🇵 日本人クリエイター向け解説
Azureのインフラ上でOpenAIモデル(GPT-4oなど)を利用し、企業コンプライアンスやセキュリティ要件を満たしながら、コンテンツフィルタリングやVNET分離された環境でOpenAIのAPIを活用するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o azure-openai.zip https://jpskill.com/download/14679.zip && unzip -o azure-openai.zip && rm azure-openai.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14679.zip -OutFile "$d\azure-openai.zip"; Expand-Archive "$d\azure-openai.zip" -DestinationPath $d -Force; ri "$d\azure-openai.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
azure-openai.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
azure-openaiフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Azure OpenAI Service
概要
Azure OpenAI Service は、Microsoft Azure インフラストラクチャ上でホストされる OpenAI のモデル (GPT-4o, GPT-4o mini, DALL-E 3, Whisper) を提供します。エンタープライズ機能として、マネージド ID 認証 (API キー不要)、VNET 統合、Azure Policy 準拠、コンテンツ フィルタリング、不正使用監視、およびリージョン データ所在地を提供します。同じ openai Python/TS SDK を使用し、Azure エンドポイントを指定するだけです。
Azure vs OpenAI Direct
| 機能 | OpenAI (direct) | Azure OpenAI |
|---|---|---|
| 認証 | API Key | API Key またはマネージド ID |
| データ所在地 | 主に米国 | 任意の Azure リージョン |
| エンタープライズ コンプライアンス | 限定的 | SOC2, HIPAA, ISO 27001 |
| コンテンツ フィルタリング | ❌ | ✅ 設定可能 |
| VNET 分離 | ❌ | ✅ プライベート エンドポイント |
| デプロイメント制御 | 共有 | 独自のデプロイメント |
| ファイン チューニング | ✅ | ✅ |
| Azure サービスへのレイテンシ | 高い | 低い (同じ場所に配置) |
セットアップ
pip install openai azure-identity # azure-identity はマネージド ID 用
# API Key 認証 (開発/テスト)
export AZURE_OPENAI_API_KEY=...
export AZURE_OPENAI_ENDPOINT=https://my-resource.openai.azure.com/
# デプロイメント名 (Azure Portal でモデルをデプロイする際に設定)
export AZURE_OPENAI_DEPLOYMENT=gpt-4o # デプロイメント名
手順
API Key を使用した基本的なチャット
from openai import AzureOpenAI
client = AzureOpenAI(
api_key="your_azure_openai_api_key",
azure_endpoint="https://my-resource.openai.azure.com/",
api_version="2024-10-21", # 最新の安定バージョンについてはドキュメントを確認してください
)
response = client.chat.completions.create(
model="gpt-4o", # これはモデル名ではなく、デプロイメント名です
messages=[
{"role": "system", "content": "あなたは親切なアシスタントです。"},
{"role": "user", "content": "Azure OpenAI Service とは何ですか?"},
],
max_tokens=1024,
temperature=0.7,
)
print(response.choices[0].message.content)
マネージド ID 認証 (API キー不要)
from openai import AzureOpenAI
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
# DefaultAzureCredential は以下で動作します。
# - マネージド ID (Azure VM, AKS, App Service, Functions 内)
# - Azure CLI (ローカル開発)
# - Visual Studio / VS Code の資格情報
credential = DefaultAzureCredential()
token_provider = get_bearer_token_provider(
credential,
"https://cognitiveservices.azure.com/.default"
)
client = AzureOpenAI(
azure_endpoint="https://my-resource.openai.azure.com/",
azure_ad_token_provider=token_provider,
api_version="2024-10-21",
)
response = client.chat.completions.create(
model="gpt-4o", # デプロイメント名
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
TypeScript / Node.js
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.AZURE_OPENAI_API_KEY,
baseURL: `${process.env.AZURE_OPENAI_ENDPOINT}openai/deployments/${process.env.AZURE_OPENAI_DEPLOYMENT}`,
defaultQuery: { "api-version": "2024-10-21" },
defaultHeaders: { "api-key": process.env.AZURE_OPENAI_API_KEY },
});
const response = await client.chat.completions.create({
model: process.env.AZURE_OPENAI_DEPLOYMENT!,
messages: [{ role: "user", content: "Explain TypeScript generics." }],
});
console.log(response.choices[0].message.content);
ストリーミング
from openai import AzureOpenAI
client = AzureOpenAI(
api_key="...",
azure_endpoint="https://my-resource.openai.azure.com/",
api_version="2024-10-21",
)
stream = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "クラウドコンピューティングについてのソネットを書いてください。"}],
stream=True,
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
print()
関数呼び出し
import json
from openai import AzureOpenAI
client = AzureOpenAI(
api_key="...",
azure_endpoint="https://my-resource.openai.azure.com/",
api_version="2024-10-21",
)
tools = [
{
"type": "function",
"function": {
"name": "get_azure_resource_cost",
"description": "当月の Azure リソースのコストを取得します",
"parameters": {
"type": "object",
"properties": {
"resource_group": {"type": "string"},
"resource_name": {"type": "string"},
},
"required": ["resource_group", "resource_name"],
},
},
}
]
messages = [{"role": "user", "content": "vm-prod01 の今月のコストはいくらですか?"}]
response = client.chat.completions.create(
model="gpt-4o",
messages=messages,
tools=tools,
tool_choice="auto",
)
if response.choices[0].finish_reason == "tool_calls":
tool_call = response.choices[0].message.tool_calls[0]
args = json.loads(tool_call.function.arguments)
print(f"Called: {tool_call.function.name} with {args}")
messages.append(response.choices[0].message)
messages.append({
"role": "tool",
"tool_call_id": tool_call.id,
"content": json.dumps({"cost_usd": 142.53, "currency": "USD"}),
})
final = client.chat.completions.create(model="gpt-4o", messages=messages)
print(final.choices[0].message.content)
DALL-E 3 を使用した画像生成
from openai import AzureOpenAI
client = AzureOpenAI(
api_key="...",
azure_endpoint="https://my-resource.openai.azure.com/",
api_version="2024-02-01", # DALL-E は異なる API バージョンを使用します
)
response = client.images.generate(
model="dall-e-3", # DALL-E 3 のデプロイメント名
prompt="ソーラーパネルを備えた未来的な都市のスカイライン、フォトリアリスティック、ゴールデンアワー",
size="1024x1024",
quality="hd",
n=1,
)
print(response.data[0].url)
print(f"Revised prompt: {response.data[0].revised_prompt}")
Whisper を使用した音声テキスト変換
(原文がここで切り詰められています) 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Azure OpenAI Service
Overview
Azure OpenAI Service provides OpenAI's models (GPT-4o, GPT-4o mini, DALL-E 3, Whisper) hosted on Microsoft Azure infrastructure. It offers enterprise features: Managed Identity authentication (no API keys), VNET integration, Azure Policy compliance, content filtering, abuse monitoring, and regional data residency. Uses the same openai Python/TS SDK — just point it at your Azure endpoint.
Azure vs OpenAI Direct
| Feature | OpenAI (direct) | Azure OpenAI |
|---|---|---|
| Auth | API Key | API Key or Managed Identity |
| Data residency | US primarily | Any Azure region |
| Enterprise compliance | Limited | SOC2, HIPAA, ISO 27001 |
| Content filtering | ❌ | ✅ Configurable |
| VNET isolation | ❌ | ✅ Private endpoints |
| Deployment control | Shared | Your own deployments |
| Fine-tuning | ✅ | ✅ |
| Latency to Azure services | Higher | Lower (co-located) |
Setup
pip install openai azure-identity # azure-identity for Managed Identity
# API Key auth (dev/test)
export AZURE_OPENAI_API_KEY=...
export AZURE_OPENAI_ENDPOINT=https://my-resource.openai.azure.com/
# Deployment names (you set these when deploying models in Azure Portal)
export AZURE_OPENAI_DEPLOYMENT=gpt-4o # Your deployment name
Instructions
Basic Chat with API Key
from openai import AzureOpenAI
client = AzureOpenAI(
api_key="your_azure_openai_api_key",
azure_endpoint="https://my-resource.openai.azure.com/",
api_version="2024-10-21", # Check docs for latest stable version
)
response = client.chat.completions.create(
model="gpt-4o", # This is your DEPLOYMENT NAME, not the model name
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is Azure OpenAI Service?"},
],
max_tokens=1024,
temperature=0.7,
)
print(response.choices[0].message.content)
Managed Identity Auth (No API Keys)
from openai import AzureOpenAI
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
# DefaultAzureCredential works with:
# - Managed Identity (in Azure VM, AKS, App Service, Functions)
# - Azure CLI (local development)
# - Visual Studio / VS Code credentials
credential = DefaultAzureCredential()
token_provider = get_bearer_token_provider(
credential,
"https://cognitiveservices.azure.com/.default"
)
client = AzureOpenAI(
azure_endpoint="https://my-resource.openai.azure.com/",
azure_ad_token_provider=token_provider,
api_version="2024-10-21",
)
response = client.chat.completions.create(
model="gpt-4o", # deployment name
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
TypeScript / Node.js
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.AZURE_OPENAI_API_KEY,
baseURL: `${process.env.AZURE_OPENAI_ENDPOINT}openai/deployments/${process.env.AZURE_OPENAI_DEPLOYMENT}`,
defaultQuery: { "api-version": "2024-10-21" },
defaultHeaders: { "api-key": process.env.AZURE_OPENAI_API_KEY },
});
const response = await client.chat.completions.create({
model: process.env.AZURE_OPENAI_DEPLOYMENT!,
messages: [{ role: "user", content: "Explain TypeScript generics." }],
});
console.log(response.choices[0].message.content);
Streaming
from openai import AzureOpenAI
client = AzureOpenAI(
api_key="...",
azure_endpoint="https://my-resource.openai.azure.com/",
api_version="2024-10-21",
)
stream = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Write a sonnet about cloud computing."}],
stream=True,
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
print()
Function Calling
import json
from openai import AzureOpenAI
client = AzureOpenAI(
api_key="...",
azure_endpoint="https://my-resource.openai.azure.com/",
api_version="2024-10-21",
)
tools = [
{
"type": "function",
"function": {
"name": "get_azure_resource_cost",
"description": "Get the cost of an Azure resource for the current month",
"parameters": {
"type": "object",
"properties": {
"resource_group": {"type": "string"},
"resource_name": {"type": "string"},
},
"required": ["resource_group", "resource_name"],
},
},
}
]
messages = [{"role": "user", "content": "How much is my vm-prod01 costing this month?"}]
response = client.chat.completions.create(
model="gpt-4o",
messages=messages,
tools=tools,
tool_choice="auto",
)
if response.choices[0].finish_reason == "tool_calls":
tool_call = response.choices[0].message.tool_calls[0]
args = json.loads(tool_call.function.arguments)
print(f"Called: {tool_call.function.name} with {args}")
messages.append(response.choices[0].message)
messages.append({
"role": "tool",
"tool_call_id": tool_call.id,
"content": json.dumps({"cost_usd": 142.53, "currency": "USD"}),
})
final = client.chat.completions.create(model="gpt-4o", messages=messages)
print(final.choices[0].message.content)
Image Generation with DALL-E 3
from openai import AzureOpenAI
client = AzureOpenAI(
api_key="...",
azure_endpoint="https://my-resource.openai.azure.com/",
api_version="2024-02-01", # DALL-E uses a different API version
)
response = client.images.generate(
model="dall-e-3", # your DALL-E 3 deployment name
prompt="A futuristic city skyline with solar panels, photorealistic, golden hour",
size="1024x1024",
quality="hd",
n=1,
)
print(response.data[0].url)
print(f"Revised prompt: {response.data[0].revised_prompt}")
Speech-to-Text with Whisper
from openai import AzureOpenAI
client = AzureOpenAI(
api_key="...",
azure_endpoint="https://my-resource.openai.azure.com/",
api_version="2024-06-01",
)
with open("recording.mp3", "rb") as audio_file:
transcript = client.audio.transcriptions.create(
model="whisper", # your Whisper deployment name
file=audio_file,
language="en",
response_format="text",
)
print(transcript)
Embeddings
from openai import AzureOpenAI
client = AzureOpenAI(
api_key="...",
azure_endpoint="https://my-resource.openai.azure.com/",
api_version="2024-10-21",
)
response = client.embeddings.create(
model="text-embedding-3-large", # deployment name
input=["The quick brown fox", "Jumps over the lazy dog"],
)
for item in response.data:
print(f"Embedding {item.index}: {len(item.embedding)} dims")
Deployment vs Model Name
A critical Azure OpenAI concept: deployments are your named instances of a model:
Azure Portal:
Resource: my-openai-resource
Deployments:
- Name: "gpt-4o" → Model: gpt-4o (2024-11-20)
- Name: "gpt-4o-mini" → Model: gpt-4o-mini (2024-07-18)
- Name: "text-embed-large" → Model: text-embedding-3-large
In code, model= takes the deployment name you configured, not the OpenAI model name.
Content Filtering Configuration
Content filters are configured in Azure Portal under your deployment settings:
- Hate, Violence, Sexual, Self-harm — each configurable (low/medium/high threshold)
- Prompt injection protection — detects jailbreak attempts
- Custom blocklists — add domain-specific blocked terms
# When content is filtered, the API returns an error:
from openai import AzureOpenAI, BadRequestError
client = AzureOpenAI(...)
try:
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "user_input"}],
)
except BadRequestError as e:
if e.code == "content_filter":
print(f"Content filtered: {e.error.innererror}")
Guidelines
- Use Managed Identity in production (AKS, App Service, Functions) — never store API keys in code.
- Each deployment is a separate Azure resource with its own quota and settings.
- Pin
api_versionto a stable version — latest is not always most stable. - Azure Content Filtering is always on by default — configure thresholds per deployment.
- For HIPAA compliance, ensure your Azure subscription has a Business Associate Agreement (BAA).
- VNET private endpoints prevent traffic from leaving your Azure network — required for strict isolation.
- Monitor usage and costs with Azure Monitor and set budget alerts on the Cognitive Services resource.