All skills
microsoft avatar

/azure-mgmt-apimanagement-dotnet

@073741f
by microsoftmicrosoft/skills3.1k stars
351

Azure Resource Manager SDK for API Management in .NET. Use for MANAGEMENT PLANE operations: creating/managing APIM services, APIs, products, subscriptions, policies, users, groups, gateways, and backends via Azure Resource Manager. Triggers: "API Management", "APIM service", "create APIM", "manage APIs", "ApiManagementServiceResource", "API policies", "APIM products", "APIM subscriptions".

Use this Skill: https://skilld.dev/gh/microsoft/skills/azure-mgmt-apimanagement-dotnet

This session only. Nothing lands on disk.

referencesservice-management.md

≈1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Service Management

Detailed patterns for managing API Management service instances.

Get Existing Service

// By resource group
var service = await resourceGroup.Value
    .GetApiManagementServiceAsync("my-apim-service");

// By resource ID
var serviceId = ApiManagementServiceResource.CreateResourceIdentifier(
    subscriptionId, "my-resource-group", "my-apim-service");
var service = armClient.GetApiManagementServiceResource(serviceId);
service = await service.GetAsync();

List Services

// In resource group
await foreach (var service in resourceGroup.Value.GetApiManagementServices())
{
    Console.WriteLine($"{service.Data.Name}: {service.Data.Location}");
}

// In subscription
await foreach (var service in subscription.GetApiManagementServicesAsync())
{
    Console.WriteLine($"{service.Data.Name}: {service.Data.ResourceGroupName}");
}

Update Service

var patch = new ApiManagementServicePatch
{
    PublisherName = "Updated Publisher",
    Tags = { ["environment"] = "production" }
};

var operation = await service.UpdateAsync(WaitUntil.Completed, patch);

Delete Service

await service.DeleteAsync(WaitUntil.Completed);

SKU Configuration

// Developer (for testing)
var devSku = new ApiManagementServiceSkuProperties(
    ApiManagementServiceSkuType.Developer, capacity: 1);

// Standard with multiple units
var standardSku = new ApiManagementServiceSkuProperties(
    ApiManagementServiceSkuType.Standard, capacity: 2);

// Premium with availability zones
var premiumData = new ApiManagementServiceData(
    location: AzureLocation.EastUS,
    sku: new ApiManagementServiceSkuProperties(
        ApiManagementServiceSkuType.Premium, capacity: 3),
    publisherEmail: "admin@contoso.com",
    publisherName: "Contoso")
{
    Zones = { "1", "2", "3" }
};

Virtual Network Integration

var serviceData = new ApiManagementServiceData(
    location: AzureLocation.EastUS,
    sku: new ApiManagementServiceSkuProperties(
        ApiManagementServiceSkuType.Premium, capacity: 1),
    publisherEmail: "admin@contoso.com",
    publisherName: "Contoso")
{
    VirtualNetworkType = VirtualNetworkType.External,
    VirtualNetworkConfiguration = new VirtualNetworkConfiguration
    {
        SubnetResourceId = new ResourceIdentifier(
            "/subscriptions/.../subnets/apim-subnet")
    }
};

Custom Domains

var serviceData = new ApiManagementServiceData(...)
{
    HostnameConfigurations =
    {
        new HostnameConfiguration(HostnameType.Proxy)
        {
            HostName = "api.contoso.com",
            CertificateSource = CertificateSource.KeyVault,
            KeyVaultSecretUri = new Uri("https://myvault.vault.azure.net/secrets/api-cert")
        },
        new HostnameConfiguration(HostnameType.DeveloperPortal)
        {
            HostName = "developer.contoso.com",
            CertificateSource = CertificateSource.KeyVault,
            KeyVaultSecretUri = new Uri("https://myvault.vault.azure.net/secrets/portal-cert")
        }
    }
};

Managed Identity

var serviceData = new ApiManagementServiceData(...)
{
    Identity = new ManagedServiceIdentity(ManagedServiceIdentityType.SystemAssigned)
};

// Or user-assigned
var serviceData = new ApiManagementServiceData(...)
{
    Identity = new ManagedServiceIdentity(ManagedServiceIdentityType.UserAssigned)
    {
        UserAssignedIdentities =
        {
            [new ResourceIdentifier("/subscriptions/.../userAssignedIdentities/my-identity")] = 
                new UserAssignedIdentity()
        }
    }
};

Get Service Information

// Get gateway URL
Console.WriteLine($"Gateway: {service.Data.GatewayUri}");

// Get portal URL
Console.WriteLine($"Portal: {service.Data.DeveloperPortalUri}");

// Get management API URL
Console.WriteLine($"Management: {service.Data.ManagementApiUri}");

// Get provisioning state
Console.WriteLine($"State: {service.Data.ProvisioningState}");

Source: SKILL.md on GitHub

1 warning15d4 checks · Risk SAFE
  • Gen Agent Trust Hub15d

    This skill facilitates the management of Azure API Management resources via the .NET SDK. It includes some security considerations regarding the handling of sensitive credentials in example code and the ingestion of external data for API definitions, which are standard for such tooling but warrant review.

  • Socket15d

    No alerts

  • Snyk15d

    Risk: LOW · No issues

  • Runlayer7mo

    5/5 files flagged

Signed by skilld at 073741f. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 19 hours ago.

Activeupdated 5 months ago
Other metadata
metadata
{
  "author": "Microsoft",
  "version": "1.0.0",
  "package": "Azure.ResourceManager.ApiManagement"
}

README badge

README badge for microsoft/skills/azure-mgmt-apimanagement-dotnet