azure-mgmt-weightsandbiases-dotnet
microsoft/skills
.NET SDK を使用して、Azure 上の W&B(重みとバイアス)ML エクスペリメントのインスタンスを管理します。マーケットプレイスとの連携および SSO を利用して、W&B インスタンスの作成、設定、一覧表示、更新、削除を行います。
...すべて拡張しますAzure.ResourceManager.WeightsAndBiases (.NET)
Azure Marketplace を通じて Weights & Biases ML 実験追跡インスタンスを展開および管理するための Azure Resource Manager SDK。
インストール
dotnet add package Azure.ResourceManager.WeightsAndBiases --prerelease
dotnet add package Azure.Identity
現在のバージョン: v1.0.0-beta.1 (プレビュー)
API バージョン: 2024-09-18-preview
環境変数
AZURE_SUBSCRIPTION_ID= # 必須: Azure サブスクリプション ID
AZURE_RESOURCE_GROUP= # 必須: Azure リソース グループ名
AZURE_WANDB_INSTANCE_NAME= # 必須: Weights & Biases インスタンス名
AZURE_TOKEN_CREDENTIALS=prod # 本番環境で DefaultAzureCredential を使用する場合にのみ必須
認証
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.WeightsAndBiases;
// ローカル開発環境: DefaultAzureCredential。本番環境: AZURE_TOKEN_CREDENTIALS=prod または AZURE_TOKEN_CREDENTIALS=を設定
var credential = new DefaultAzureCredential(
DefaultAzureCredential.DefaultEnvironmentVariableName
);
// または、本番環境では特定の認証情報を直接使用します:
// https://learn.microsoft.com/dotnet/api/overview/azure/identity-readme?view=azure-dotnet#credential-classes を参照
// var credential = new ManagedIdentityCredential();
ArmClient client = new ArmClient(credential);
リソース階層
サブスクリプション
└── リソースグループ
└── WeightsAndBiasesInstance # Azure Marketplace からの W&B デプロイ
├── Properties
│ ├── Marketplace # オファーの詳細、プラン、発行者
│ ├── User # 管理者ユーザー情報
│ ├── PartnerProperties # W&B固有の設定(リージョン、サブドメイン)
│ └── SingleSignOnPropertiesV2 # Entra ID SSOの設定
└── Identity # マネージド ID(オプション)
主要なワークフロー
1. Weights & Biases インスタンスの作成
using Azure.ResourceManager.WeightsAndBiases;
using Azure.ResourceManager.WeightsAndBiases.Models;
ResourceGroupResource resourceGroup = await client
.GetDefaultSubscriptionAsync()
.Result
.GetResourceGroupAsync("my-resource-group");
WeightsAndBiasesInstanceCollection instances = resourceGroup.GetWeightsAndBiasesInstances();
WeightsAndBiasesInstanceData data = new WeightsAndBiasesInstanceData(AzureLocation.EastUS)
{
Properties = new WeightsAndBiasesInstanceProperties
{
// マーケットプレイスの構成
Marketplace = new WeightsAndBiasesMarketplaceDetails
{
SubscriptionId = "",
OfferDetails = new WeightsAndBiasesOfferDetails
{
PublisherId = "wandb",
OfferId = "wandb-pay-as-you-go",
PlanId = "wandb-payg",
PlanName = "Pay As You Go",
TermId = "monthly",
TermUnit = "P1M"
}
},
// 管理者ユーザー
User = new WeightsAndBiasesUserDetails
{
FirstName = "Admin",
LastName = "User",
EmailAddress = "[email protected]",
Upn = "[email protected]"
},
// W&B固有の設定
PartnerProperties = new WeightsAndBiasesPartnerProperties
{
Region = WeightsAndBiasesRegion.EastUS,
Subdomain = "my-company-wandb"
}
},
// オプション: マネージド ID を有効にする
Identity = new ManagedServiceIdentity(ManagedServiceIdentityType.SystemAssigned)
};
ArmOperation operation = await instances
.CreateOrUpdateAsync(WaitUntil.Completed, "my-wandb-instance", data);
WeightsAndBiasesInstanceResource instance = operation.Value;
Console.WriteLine($"W&B インスタンスが作成されました: {instance.Data.Name}");
Console.WriteLine($"プロビジョニング状態: {instance.Data.Properties.ProvisioningState}");
2. 既存のインスタンスの取得
WeightsAndBiasesInstanceResource instance = await resourceGroup
.GetWeightsAndBiasesInstanceAsync("my-wandb-instance");
Console.WriteLine($"インスタンス: {instance.Data.Name}");
Console.WriteLine($"ロケーション: {instance.Data.Location}");
Console.WriteLine($"状態: {instance.Data.Properties.ProvisioningState}");
if (instance.Data.Properties.PartnerProperties != null)
{
Console.WriteLine($"リージョン: {instance.Data.Properties.PartnerProperties.Region}");
Console.WriteLine($"サブドメイン: {instance.Data.Properties.PartnerProperties.Subdomain}");
}
3. すべてのインスタンスの一覧表示
// リソースグループ内のインスタンスを一覧表示
await foreach (WeightsAndBiasesInstanceResource instance in
resourceGroup.GetWeightsAndBiasesInstances())
{
Console.WriteLine($"インスタンス: {instance.Data.Name}");
Console.WriteLine($" ロケーション: {instance.Data.Location}");
Console.WriteLine($" 状態: {instance.Data.Properties.ProvisioningState}");
}
// サブスクリプション内のリスト
SubscriptionResource subscription = await client.GetDefaultSubscriptionAsync();
await foreach (WeightsAndBiasesInstanceResource instance in
subscription.GetWeightsAndBiasesInstancesAsync())
{
Console.WriteLine($"{instance.Data.Name} が {instance.Id.ResourceGroupName} にあります");
}
4. シングルサインオン (SSO) の設定
WeightsAndBiasesInstanceResource instance = await resourceGroup
.GetWeightsAndBiasesInstanceAsync("my-wandb-instance");
// SSO 設定で更新
WeightsAndBiasesInstanceData updateData = instance.Data;
updateData.Properties.SingleSignOnPropertiesV2 = new WeightsAndBiasSingleSignOnPropertiesV2
{
Type = WeightsAndBiasSingleSignOnType.Saml,
State = WeightsAndBiasSingleSignOnState.Enable,
EnterpriseAppId = "",
AadDomains = { "example.com", "contoso.com" }
};
ArmOperation operation = await resourceGroup
.GetWeightsAndBiasesInstances()
.CreateOrUpdateAsync(WaitUntil.Completed, "my-wandb-instance", updateData);
5. インスタンスの更新
WeightsAndBiasesInstanceResource instance = await resourceGroup
.GetWeightsAndBiasesInstanceAsync("my-wandb-instance");
// タグを更新
WeightsAndBiasesInstancePatch patch = new WeightsAndBiasesInstancePatch
{
Tags =
{
{ "environment", "production" },
{ "team", "ml-platform" },
{ "costCenter", "CC-ML-001" }
}
};
instance = await instance.UpdateAsync(patch);
Console.WriteLine($"インスタンスを更新しました: {instance.Data.Name}");
6. インスタンスの削除
WeightsAndBiasesInstanceResource instance = await resourceGroup
.GetWeightsAndBiasesInstanceAsync("my-wandb-instance");
await instance.DeleteAsync(WaitUntil.Completed);
Console.WriteLine("インスタンスが削除されました");
7. リソース名の利用可否の確認
// 作成前に名前が利用可能かどうかを確認
// (SDKでこの機能が提供されていない場合は、ARMを直接呼び出して実装する)
try
{
await resourceGroup.GetWeightsAndBiasesInstanceAsync("desired-name");
Console.WriteLine("名前はすでに使用されています");
}
catch (RequestFailedException ex) when (ex.Status == 404)
{
Console.WriteLine("名前が利用可能です");
}
キーの種類のリファレンス
| 型 | 目的 |
|---|---|
WeightsAndBiasesInstanceResource |
W&B インスタンスリソース |
WeightsAndBiasesInstanceData |
インスタンス構成データ |
WeightsAndBiasesInstanceCollection |
インスタンスのコレクション |
重みとバイアスインスタンスのプロパティ |
インスタンスのプロパティ |
重みとバイアスのマーケットプレイス詳細 |
マーケットプレイスのサブスクリプション情報 |
重みとバイアスのオファー詳細 |
マーケットプレイスのオファーの詳細 |
重みとバイアス:ユーザー詳細 |
管理者ユーザー情報 |
WeightsAndBiasesパートナープロパティ |
W&B固有の設定 |
WeightsAndBiasSingleSignOnPropertiesV2 |
SSOの設定 |
WeightsAndBiasesInstancePatch |
更新用パッチ |
WeightsAndBiasesRegion |
サポートされているリージョンの列挙 |
利用可能なリージョン
| リージョンの列挙型 | Azure リージョン |
|---|---|
WeightsAndBiasesRegion.EastUS |
米国東部 |
WeightsAndBiasesRegion.CentralUS |
米国中部 |
WeightsAndBiasesRegion.WestUS |
米国西部 |
WeightsAndBiasesRegion.WestEurope |
西ヨーロッパ |
WeightsAndBiasesRegion.JapanEast |
日本(東) |
WeightsAndBiasesRegion.KoreaCentral |
韓国中部 |
マーケットプレイスのオファー詳細
Azure Marketplace との連携について:
| プロパティ | 値 |
|---|---|
| 発行者 ID | wandb |
| オファー ID | wandb-pay-as-you-go |
| プランID | wandb-payg(従量課金制) |
ベストプラクティス
- DefaultAzureCredential を使用する— 複数の認証方法を自動的にサポート
- マネージド ID を有効にする— 他の Azure リソースへの安全なアクセスのため
- SSO の構成— エンタープライズレベルのセキュリティのために Entra ID SSO を有効にする
- リソースにタグを付ける— コスト追跡や整理のためにタグを使用する
- プロビジョニング状態の確認— インスタンスを使用する前に「
成功」となるまで待機する - 適切なリージョンを使用する— コンピューティング環境に最も近いリージョンを選択する
- Azure による監視— リソースの健全性確認に Azure Monitor を使用する
エラー処理
using Azure;
try
{
ArmOperation operation = await instances
.CreateOrUpdateAsync(WaitUntil.Completed, "my-wandb", data);
}
catch (RequestFailedException ex) when (ex.Status == 409)
{
Console.WriteLine("インスタンスがすでに存在するか、名前が重複しています");
}
catch (RequestFailedException ex) when (ex.Status == 400)
{
Console.WriteLine($"無効な構成: {ex.Message}");
}
catch (RequestFailedException ex)
{
Console.WriteLine($"Azure エラー: {ex.Status} - {ex.Message}");
}
W&B SDK との連携
Azureリソースを作成した後、実験の追跡にはW&B Python SDKを使用します:
# インストール: pip install wandb
import wandb
# Azureにデプロイされたインスタンスから、W&B APIキーを使用してログイン
wandb.login(host="https://my-company-wandb.wandb.ai")
# 実行の初期化
run = wandb.init(project="my-ml-project")
# メトリクスの記録
wandb.log({"accuracy": 0.95, "loss": 0.05})
# 実行の終了
run.finish()
関連する SDK
| SDK | 目的 | インストール |
|---|---|---|
Azure.ResourceManager.WeightsAndBiases |
W&B インスタンスの管理 (この SDK) | dotnet add package Azure.ResourceManager.WeightsAndBiases --prerelease |
Azure.ResourceManager.MachineLearning |
Azure ML ワークスペース | dotnet add package Azure.ResourceManager.MachineLearning |
参考リンク
| リソース | URL |
|---|---|
| NuGet パッケージ | https://www.nuget.org/packages/Azure.ResourceManager.WeightsAndBiases |
| W&B ドキュメント | https://docs.wandb.ai/ |
| Azure Marketplace | https://azuremarketplace.microsoft.com/marketplace/apps/wandb.wandb-pay-as-you-go |
| GitHub ソース | https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/weightsandbiases |
---
name: azure-mgmt-weightsandbiases-dotnet
description: Manage Weights & Biases ML experiment tracking instances on Azure using the .NET SDK. Create, configure, list, update, and delete W&B instances with marketplace integration and SSO.
license: MIT
---
# Azure.ResourceManager.WeightsAndBiases (.NET)
Azure Resource Manager SDK for deploying and managing Weights & Biases ML experiment tracking instances via Azure Marketplace.
## Installation
```bash
dotnet add package Azure.ResourceManager.WeightsAndBiases --prerelease
dotnet add package Azure.Identity
```
**Current Version**: v1.0.0-beta.1 (preview)
**API Version**: 2024-09-18-preview
## Environment Variables
```bash
AZURE_SUBSCRIPTION_ID=<your-subscription-id> # Required: Azure subscription ID
AZURE_RESOURCE_GROUP=<your-resource-group> # Required: Azure resource group name
AZURE_WANDB_INSTANCE_NAME=<your-wandb-instance> # Required: Weights & Biases instance name
AZURE_TOKEN_CREDENTIALS=prod # Required only if DefaultAzureCredential is used in production
```
## Authentication
```csharp
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.WeightsAndBiases;
// Local dev: DefaultAzureCredential. Production: set AZURE_TOKEN_CREDENTIALS=prod or AZURE_TOKEN_CREDENTIALS=<specific_credential>
var credential = new DefaultAzureCredential(
DefaultAzureCredential.DefaultEnvironmentVariableName
);
// Or use a specific credential directly in production:
// See https://learn.microsoft.com/dotnet/api/overview/azure/identity-readme?view=azure-dotnet#credential-classes
// var credential = new ManagedIdentityCredential();
ArmClient client = new ArmClient(credential);
```
## Resource Hierarchy
```
Subscription
└── ResourceGroup
└── WeightsAndBiasesInstance # W&B deployment from Azure Marketplace
├── Properties
│ ├── Marketplace # Offer details, plan, publisher
│ ├── User # Admin user info
│ ├── PartnerProperties # W&B-specific config (region, subdomain)
│ └── SingleSignOnPropertiesV2 # Entra ID SSO configuration
└── Identity # Managed identity (optional)
```
## Core Workflows
### 1. Create Weights & Biases Instance
```csharp
using Azure.ResourceManager.WeightsAndBiases;
using Azure.ResourceManager.WeightsAndBiases.Models;
ResourceGroupResource resourceGroup = await client
.GetDefaultSubscriptionAsync()
.Result
.GetResourceGroupAsync("my-resource-group");
WeightsAndBiasesInstanceCollection instances = resourceGroup.GetWeightsAndBiasesInstances();
WeightsAndBiasesInstanceData data = new WeightsAndBiasesInstanceData(AzureLocation.EastUS)
{
Properties = new WeightsAndBiasesInstanceProperties
{
// Marketplace configuration
Marketplace = new WeightsAndBiasesMarketplaceDetails
{
SubscriptionId = "<marketplace-subscription-id>",
OfferDetails = new WeightsAndBiasesOfferDetails
{
PublisherId = "wandb",
OfferId = "wandb-pay-as-you-go",
PlanId = "wandb-payg",
PlanName = "Pay As You Go",
TermId = "monthly",
TermUnit = "P1M"
}
},
// Admin user
User = new WeightsAndBiasesUserDetails
{
FirstName = "Admin",
LastName = "User",
EmailAddress = "[email protected]",
Upn = "[email protected]"
},
// W&B-specific configuration
PartnerProperties = new WeightsAndBiasesPartnerProperties
{
Region = WeightsAndBiasesRegion.EastUS,
Subdomain = "my-company-wandb"
}
},
// Optional: Enable managed identity
Identity = new ManagedServiceIdentity(ManagedServiceIdentityType.SystemAssigned)
};
ArmOperation<WeightsAndBiasesInstanceResource> operation = await instances
.CreateOrUpdateAsync(WaitUntil.Completed, "my-wandb-instance", data);
WeightsAndBiasesInstanceResource instance = operation.Value;
Console.WriteLine($"W&B Instance created: {instance.Data.Name}");
Console.WriteLine($"Provisioning state: {instance.Data.Properties.ProvisioningState}");
```
### 2. Get Existing Instance
```csharp
WeightsAndBiasesInstanceResource instance = await resourceGroup
.GetWeightsAndBiasesInstanceAsync("my-wandb-instance");
Console.WriteLine($"Instance: {instance.Data.Name}");
Console.WriteLine($"Location: {instance.Data.Location}");
Console.WriteLine($"State: {instance.Data.Properties.ProvisioningState}");
if (instance.Data.Properties.PartnerProperties != null)
{
Console.WriteLine($"Region: {instance.Data.Properties.PartnerProperties.Region}");
Console.WriteLine($"Subdomain: {instance.Data.Properties.PartnerProperties.Subdomain}");
}
```
### 3. List All Instances
```csharp
// List in resource group
await foreach (WeightsAndBiasesInstanceResource instance in
resourceGroup.GetWeightsAndBiasesInstances())
{
Console.WriteLine($"Instance: {instance.Data.Name}");
Console.WriteLine($" Location: {instance.Data.Location}");
Console.WriteLine($" State: {instance.Data.Properties.ProvisioningState}");
}
// List in subscription
SubscriptionResource subscription = await client.GetDefaultSubscriptionAsync();
await foreach (WeightsAndBiasesInstanceResource instance in
subscription.GetWeightsAndBiasesInstancesAsync())
{
Console.WriteLine($"{instance.Data.Name} in {instance.Id.ResourceGroupName}");
}
```
### 4. Configure Single Sign-On (SSO)
```csharp
WeightsAndBiasesInstanceResource instance = await resourceGroup
.GetWeightsAndBiasesInstanceAsync("my-wandb-instance");
// Update with SSO configuration
WeightsAndBiasesInstanceData updateData = instance.Data;
updateData.Properties.SingleSignOnPropertiesV2 = new WeightsAndBiasSingleSignOnPropertiesV2
{
Type = WeightsAndBiasSingleSignOnType.Saml,
State = WeightsAndBiasSingleSignOnState.Enable,
EnterpriseAppId = "<entra-app-id>",
AadDomains = { "example.com", "contoso.com" }
};
ArmOperation<WeightsAndBiasesInstanceResource> operation = await resourceGroup
.GetWeightsAndBiasesInstances()
.CreateOrUpdateAsync(WaitUntil.Completed, "my-wandb-instance", updateData);
```
### 5. Update Instance
```csharp
WeightsAndBiasesInstanceResource instance = await resourceGroup
.GetWeightsAndBiasesInstanceAsync("my-wandb-instance");
// Update tags
WeightsAndBiasesInstancePatch patch = new WeightsAndBiasesInstancePatch
{
Tags =
{
{ "environment", "production" },
{ "team", "ml-platform" },
{ "costCenter", "CC-ML-001" }
}
};
instance = await instance.UpdateAsync(patch);
Console.WriteLine($"Updated instance: {instance.Data.Name}");
```
### 6. Delete Instance
```csharp
WeightsAndBiasesInstanceResource instance = await resourceGroup
.GetWeightsAndBiasesInstanceAsync("my-wandb-instance");
await instance.DeleteAsync(WaitUntil.Completed);
Console.WriteLine("Instance deleted");
```
### 7. Check Resource Name Availability
```csharp
// Check if name is available before creating
// (Implement via direct ARM call if SDK doesn't expose this)
try
{
await resourceGroup.GetWeightsAndBiasesInstanceAsync("desired-name");
Console.WriteLine("Name is already taken");
}
catch (RequestFailedException ex) when (ex.Status == 404)
{
Console.WriteLine("Name is available");
}
```
## Key Types Reference
| Type | Purpose |
|------|---------|
| `WeightsAndBiasesInstanceResource` | W&B instance resource |
| `WeightsAndBiasesInstanceData` | Instance configuration data |
| `WeightsAndBiasesInstanceCollection` | Collection of instances |
| `WeightsAndBiasesInstanceProperties` | Instance properties |
| `WeightsAndBiasesMarketplaceDetails` | Marketplace subscription info |
| `WeightsAndBiasesOfferDetails` | Marketplace offer details |
| `WeightsAndBiasesUserDetails` | Admin user information |
| `WeightsAndBiasesPartnerProperties` | W&B-specific configuration |
| `WeightsAndBiasSingleSignOnPropertiesV2` | SSO configuration |
| `WeightsAndBiasesInstancePatch` | Patch for updates |
| `WeightsAndBiasesRegion` | Supported regions enum |
## Available Regions
| Region Enum | Azure Region |
|-------------|--------------|
| `WeightsAndBiasesRegion.EastUS` | East US |
| `WeightsAndBiasesRegion.CentralUS` | Central US |
| `WeightsAndBiasesRegion.WestUS` | West US |
| `WeightsAndBiasesRegion.WestEurope` | West Europe |
| `WeightsAndBiasesRegion.JapanEast` | Japan East |
| `WeightsAndBiasesRegion.KoreaCentral` | Korea Central |
## Marketplace Offer Details
For Azure Marketplace integration:
| Property | Value |
|----------|-------|
| Publisher ID | `wandb` |
| Offer ID | `wandb-pay-as-you-go` |
| Plan ID | `wandb-payg` (Pay As You Go) |
## Best Practices
1. **Use DefaultAzureCredential** — Supports multiple auth methods automatically
2. **Enable managed identity** — For secure access to other Azure resources
3. **Configure SSO** — Enable Entra ID SSO for enterprise security
4. **Tag resources** — Use tags for cost tracking and organization
5. **Check provisioning state** — Wait for `Succeeded` before using instance
6. **Use appropriate region** — Choose region closest to your compute
7. **Monitor with Azure** — Use Azure Monitor for resource health
## Error Handling
```csharp
using Azure;
try
{
ArmOperation<WeightsAndBiasesInstanceResource> operation = await instances
.CreateOrUpdateAsync(WaitUntil.Completed, "my-wandb", data);
}
catch (RequestFailedException ex) when (ex.Status == 409)
{
Console.WriteLine("Instance already exists or name conflict");
}
catch (RequestFailedException ex) when (ex.Status == 400)
{
Console.WriteLine($"Invalid configuration: {ex.Message}");
}
catch (RequestFailedException ex)
{
Console.WriteLine($"Azure error: {ex.Status} - {ex.Message}");
}
```
## Integration with W&B SDK
After creating the Azure resource, use the W&B Python SDK for experiment tracking:
```python
# Install: pip install wandb
import wandb
# Login with your W&B API key from the Azure-deployed instance
wandb.login(host="https://my-company-wandb.wandb.ai")
# Initialize a run
run = wandb.init(project="my-ml-project")
# Log metrics
wandb.log({"accuracy": 0.95, "loss": 0.05})
# Finish run
run.finish()
```
## Related SDKs
| SDK | Purpose | Install |
|-----|---------|---------|
| `Azure.ResourceManager.WeightsAndBiases` | W&B instance management (this SDK) | `dotnet add package Azure.ResourceManager.WeightsAndBiases --prerelease` |
| `Azure.ResourceManager.MachineLearning` | Azure ML workspaces | `dotnet add package Azure.ResourceManager.MachineLearning` |
## Reference Links
| Resource | URL |
|----------|-----|
| NuGet Package | https://www.nuget.org/packages/Azure.ResourceManager.WeightsAndBiases |
| W&B Documentation | https://docs.wandb.ai/ |
| Azure Marketplace | https://azuremarketplace.microsoft.com/marketplace/apps/wandb.wandb-pay-as-you-go |
| GitHub Source | https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/weightsandbiases |
すべてのファイル
0件のファイルazure-mgmt-weightsandbiases-dotnetをインストール
スキルファイルをダウンロードし、.claude/skills/ ディレクトリに解凍してください。
ZIPをダウンロードリポジトリをクローンし、スキルファイルをプロジェクトにコピーしてください。
git clone https://github.com/microsoft/skills/tree/main/.github/plugins/azure-sdk-dotnet/skills/azure-mgmt-weightsandbiases-dotnet # Copy SKILL.md to your .claude/skills/ directory
コピー





家
