azure-resource-manager-playwright-dotnet – skill DevOps & Hạ tầng cho agent AI
SDK Azure Resource Manager cho Microsoft Playwright Testing trên .NET.
Cài skill azure-resource-manager-playwright-dotnet bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-resource-manager-playwright-dotnet-bde25.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /azure-resource-manager-playwright-dotnet – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-resource-manager-playwright-dotnet-bde25.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $azure-resource-manager-playwright-dotnet – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-resource-manager-playwright-dotnet-bde25.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /azure-resource-manager-playwright-dotnet – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-resource-manager-playwright-dotnet-bde25.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /azure-resource-manager-playwright-dotnet – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Azure.ResourceManager.Playwright (.NET)
Management plane SDK for provisioning and managing Microsoft Playwright Testing workspaces via Azure Resource Manager.
> ⚠️ Management vs Test Execution
> - This SDK (Azure.ResourceManager.Playwright): Create workspaces, manage quotas, check name availability
> - Test Execution SDK (Azure.Developer.MicrosoftPlaywrightTesting.NUnit): Run Playwright tests at scale on cloud browsers
Version and provisioning boundary
These are historical SDK fragments, not verified current package/service versions. Confirm the current Microsoft service lifecycle, package migration guidance and target resource provider before provisioning; stop if the named service is retired or unavailable. Select a production credential deliberately for the deployment environment rather than assuming every DefaultAzureCredential source is intended. Confirm subscription/resource group/region, budget and deletion scope; resource creation is billable and does not authorize remote test execution or uploading private test artifacts.
Installation
dotnet add package Azure.ResourceManager.Playwright
dotnet add package Azure.IdentityExample version context: v1.0.0 / v1.0.0-beta.1 are historical references; verify the supported package before use.
Environment Variables
AZURE_SUBSCRIPTION_ID=<your-subscription-id>
# For service principal auth (optional)
AZURE_TENANT_ID=<tenant-id>
AZURE_CLIENT_ID=<client-id>
AZURE_CLIENT_SECRET=<client-secret>Authentication
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Playwright;
// Always use DefaultAzureCredential
var credential = new DefaultAzureCredential();
var armClient = new ArmClient(credential);
// Get subscription
var subscriptionId = Environment.GetEnvironmentVariable("AZURE_SUBSCRIPTION_ID");
var subscription = armClient.GetSubscriptionResource(
new ResourceIdentifier($"/subscriptions/{subscriptionId}"));Resource Hierarchy
ArmClient
└── SubscriptionResource
├── PlaywrightQuotaResource (subscription-level quotas)
└── ResourceGroupResource
└── PlaywrightWorkspaceResource
└── PlaywrightWorkspaceQuotaResource (workspace-level quotas)Core Workflow
1. Create Playwright Workspace
using Azure.ResourceManager.Playwright;
using Azure.ResourceManager.Playwright.Models;
// Get resource group
var resourceGroup = await subscription
.GetResourceGroupAsync("my-resource-group");
// Define workspace
var workspaceData = new PlaywrightWorkspaceData(AzureLocation.WestUS3)
{
// Optional: Configure regional affinity and local auth
RegionalAffinity = PlaywrightRegionalAffinity.Enabled,
LocalAuth = PlaywrightLocalAuth.Enabled,
Tags =
{
["Team"] = "Dev Exp",
["Environment"] = "Production"
}
};
// Create workspace (long-running operation)
var workspaceCollection = resourceGroup.Value.GetPlaywrightWorkspaces();
var operation = await workspaceCollection.CreateOrUpdateAsync(
WaitUntil.Completed,
"my-playwright-workspace",
workspaceData);
PlaywrightWorkspaceResource workspace = operation.Value;
// Get the data plane URI for running tests
Console.WriteLine($"Data Plane URI: {workspace.Data.DataplaneUri}");
Console.WriteLine($"Workspace ID: {workspace.Data.WorkspaceId}");2. Get Existing Workspace
// Get by name
var workspace = await workspaceCollection.GetAsync("my-playwright-workspace");
// Or check if exists first
bool exists = await workspaceCollection.ExistsAsync("my-playwright-workspace");
if (exists)
{
var existingWorkspace = await workspaceCollection.GetAsync("my-playwright-workspace");
Console.WriteLine($"Workspace found: {existingWorkspace.Value.Data.Name}");
}3. List Workspaces
// List in resource group
await foreach (var workspace in workspaceCollection.GetAllAsync())
{
Console.WriteLine($"Workspace: {workspace.Data.Name}");
Console.WriteLine($" Location: {workspace.Data.Location}");
Console.WriteLine($" State: {workspace.Data.ProvisioningState}");
Console.WriteLine($" Data Plane URI: {workspace.Data.DataplaneUri}");
}
// List across subscription
await foreach (var workspace in subscription.GetPlaywrightWorkspacesAsync())
{
Console.WriteLine($"Workspace: {workspace.Data.Name}");
}4. Update Workspace
var patch = new PlaywrightWorkspacePatch
{
Tags =
{
["Team"] = "Dev Exp",
["Environment"] = "Staging",
["UpdatedAt"] = DateTime.UtcNow.ToString("o")
}
};
var updatedWorkspace = await workspace.Value.UpdateAsync(patch);5. Check Name Availability
using Azure.ResourceManager.Playwright.Models;
var checkRequest = new PlaywrightCheckNameAvailabilityContent
{
Name = "my-new-workspace",
ResourceType = "Microsoft.LoadTestService/playwrightWorkspaces"
};
var result = await subscription.CheckPlaywrightNameAvailabilityAsync(checkRequest);
if (result.Value.IsNameAvailable == true)
{
Console.WriteLine("Name is available!");
}
else
{
Console.WriteLine($"Name unavailable: {result.Value.Message}");
Console.WriteLine($"Reason: {result.Value.Reason}");
}6. Get Quota Information
// Subscription-level quotas
await foreach (var quota in subscription.GetPlaywrightQuotasAsync(AzureLocation.WestUS3))
{
Console.WriteLine($"Quota: {quota.Data.Name}");
Console.WriteLine($" Limit: {quota.Data.Limit}");
Console.WriteLine($" Used: {quota.Data.Used}");
}
// Workspace-level quotas
var workspaceQuotas = workspace.Value.GetAllPlaywrightWorkspaceQuota();
await foreach (var quota in workspaceQuotas.GetAllAsync())
{
Console.WriteLine($"Workspace Quota: {quota.Data.Name}");
}7. Delete Workspace
// Delete (long-running operation)
await workspace.Value.DeleteAsync(WaitUntil.Completed);Key Types Reference
| Type | Purpose |
|------|---------|
| ArmClient | Entry point for all ARM operations |
| PlaywrightWorkspaceResource | Represents a Playwright Testing workspace |
| PlaywrightWorkspaceCollection | Collection for workspace CRUD |
| PlaywrightWorkspaceData | Workspace creation/response payload |
| PlaywrightWorkspacePatch | Workspace update payload |
| PlaywrightQuotaResource | Subscription-level quota information |
| PlaywrightWorkspaceQuotaResource | Workspace-level quota information |
| PlaywrightExtensions | Extension methods for ARM resources |
| PlaywrightCheckNameAvailabilityContent | Name availability check request |
Workspace Properties
| Property | Description |
|----------|-------------|
| DataplaneUri | URI for running tests (e.g., https://api.dataplane.{guid}.domain.com) |
| WorkspaceId | Unique workspace identifier (GUID) |
| RegionalAffinity | Enable/disable regional affinity for test execution |
| LocalAuth | Enable/disable local authentication (access tokens) |
| ProvisioningState | Current provisioning state (Succeeded, Failed, etc.) |
Best Practices
1. Use WaitUntil.Completed for operations that must finish before proceeding
2. Use WaitUntil.Started when you want to poll manually or run operations in parallel
3. Always use DefaultAzureCredential — never hardcode keys
4. Handle RequestFailedException for ARM API errors
5. Use CreateOrUpdateAsync for idempotent operations
6. Navigate hierarchy via Get* methods (e.g., resourceGroup.GetPlaywrightWorkspaces())
7. Store the DataplaneUri after workspace creation for test execution configuration
Error Handling
using Azure;
try
{
var operation = await workspaceCollection.CreateOrUpdateAsync(
WaitUntil.Completed, workspaceName, workspaceData);
}
catch (RequestFailedException ex) when (ex.Status == 409)
{
Console.WriteLine("Workspace already exists");
}
catch (RequestFailedException ex) when (ex.Status == 400)
{
Console.WriteLine($"Bad request: {ex.Message}");
}
catch (RequestFailedException ex)
{
Console.WriteLine($"ARM Error: {ex.Status} - {ex.ErrorCode}: {ex.Message}");
}Integration with Test Execution
After creating a workspace, use the DataplaneUri to configure your Playwright tests:
// 1. Create workspace (this SDK)
var workspace = await workspaceCollection.CreateOrUpdateAsync(
WaitUntil.Completed, "my-workspace", workspaceData);
// 2. Get the service URL
var serviceUrl = workspace.Value.Data.DataplaneUri;
// 3. Set environment variable for test execution
Environment.SetEnvironmentVariable("PLAYWRIGHT_SERVICE_URL", serviceUrl.ToString());
// 4. Run tests using Azure.Developer.MicrosoftPlaywrightTesting.NUnit
// (separate package for test execution)Related SDKs
| SDK | Purpose | Install |
|-----|---------|---------|
| Azure.ResourceManager.Playwright | Management plane (this SDK) | dotnet add package Azure.ResourceManager.Playwright |
| `Azure.Deve
… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- azure-resource-manager-redis-dotnet – SDK Azure Resource Manager cho Redis trên .NET.
- azure-resource-manager-sql-dotnet – SDK Azure Resource Manager cho Azure SQL trên .NET.
- azure-search-documents-dotnet – SDK Azure AI Search cho .NET (Azure.Search.Documents). Dùng để xây dựng ứng dụng tìm…
- azure-search-documents-py – SDK Azure AI Search cho Python. Dùng cho tìm kiếm vector, tìm kiếm hybrid, xếp hạng ngữ…
- azure-search-documents-ts – Xây dựng ứng dụng tìm kiếm với khả năng tìm kiếm vector, hybrid và ngữ nghĩa (semantic).
- azure-security-keyvault-keys-dotnet – SDK Azure Key Vault Keys cho .NET. Thư viện client để quản lý khóa mật mã trong Azure…
- azure-servicebus-dotnet – SDK Azure Service Bus cho .NET. Nhắn tin doanh nghiệp với queue, topic, subscription và…
- azure-servicebus-py – SDK Azure Service Bus cho Python. Dùng cho queue, topic, subscription và các mẫu nhắn…