All skills
microsoft avatar

/azure-upgrade

@b3c238e
by microsoftmicrosoft/skills3.1k stars
351

Assess and upgrade Azure workloads between plans, tiers, or SKUs, or modernize Azure SDK dependencies in source code. WHEN: upgrade Consumption to Flex Consumption, upgrade Azure Functions plan, change hosting plan, function app SKU, migrate App Service to Container Apps, modernize legacy Azure Java SDKs (com.microsoft.azure to com.azure), migrate Azure Cache for Redis (ACR/ACRE) to Azure Managed Redis (AMR).

Use this Skill: https://skilld.dev/gh/microsoft/skills/azure-upgrade

This session only. Nothing lands on disk.

referenceslanguagesjavapackage-specificcom.microsoft.azure.eventprocessorhost.md

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

com.microsoft.azure.eventprocessorhost

Hard Rules (MUST follow)

  • MUST replace any legacy InMemoryCheckpointManager / InMemoryLeaseManager and any EventProcessorHost checkpoint/lease usage with BlobCheckpointStore backed by Azure Blob Storage. This is the only acceptable replacement.
  • MUST NOT create a class named InMemoryCheckpointStore, copy/inline SampleCheckpointStore, or implement any custom in-memory CheckpointStore. The modern SDK intentionally omits an in-memory implementation due to production issues.
  • MUST NOT introduce any other custom CheckpointStore implementation as part of this migration. If the legacy code stored checkpoints in memory, switch to BlobCheckpointStore — do not preserve the in-memory semantics.
  • If the user explicitly asks for an in-memory implementation, refuse and direct them to the upstream SampleCheckpointStore reference instead of generating one.

⚠️ Important: The switch from InMemoryCheckpointManager/InMemoryLeaseManager to BlobCheckpointStore is an expected and necessary behavioral change. It is inherent to the modern SDK design and must not block the migration from completing. Do not treat this behavioral difference as a migration defect or attempt to preserve in-memory semantics — proceed with BlobCheckpointStore and complete the migration.

Code Samples

EventProcessorHost with InMemoryCheckpointManager / InMemoryLeaseManager

Replace usage of InMemoryCheckpointManager / InMemoryLeaseManager with BlobCheckpointStore. The modern EventProcessorClient does not ship an in-memory checkpoint store, and you must not create one.

Legacy code:

InMemoryCheckpointManager checkpointManager = new InMemoryCheckpointManager();
InMemoryLeaseManager leaseManager = new InMemoryLeaseManager();
EventProcessorHost host = new EventProcessorHost(
    hostName, eventHubName, consumerGroupName,
    eventHubConnectionString, checkpointManager, leaseManager);
host.registerEventProcessor(MyEventProcessor.class).get();

Migrated code — replace with BlobCheckpointStore backed by Azure Blob Storage:

BlobContainerAsyncClient blobContainerClient = new BlobContainerClientBuilder()
    .connectionString(storageConnectionString)
    .containerName(storageContainerName)
    .buildAsyncClient();

// BlobCheckpointStore is the only supported replacement for InMemoryCheckpointManager/InMemoryLeaseManager.
// Do NOT create an InMemoryCheckpointStore or copy SampleCheckpointStore — there is no in-memory store in the modern SDK.
EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder()
    .connectionString(eventHubConnectionString, eventHubName)
    .consumerGroup(consumerGroupName)
    .checkpointStore(new BlobCheckpointStore(blobContainerClient))
    .processEvent(eventContext -> {
        // Process event and checkpoint
        eventContext.updateCheckpoint();
    })
    .processError(errorContext -> {
        System.err.printf("Error in partition %s: %s%n",
            errorContext.getPartitionContext().getPartitionId(),
            errorContext.getThrowable().getMessage());
    })
    .buildEventProcessorClient();

eventProcessorClient.start();

⚠️ Warning: Add dependency com.azure:azure-messaging-eventhubs-checkpointstore-blob to the project when using BlobCheckpointStore.

EventProcessorHost with Azure Storage checkpoint/lease

Legacy code using the built-in storage-backed checkpoint/lease:

EventProcessorHost host = EventProcessorHost.EventProcessorHostBuilder
    .newBuilder(hostName, consumerGroupName)
    .useAzureStorageCheckpointLeaseManager(storageConnectionString, storageContainerName, null)
    .useEventHubConnectionString(eventHubConnectionString, eventHubName)
    .build();
host.registerEventProcessor(MyEventProcessor.class).get();

Migrated code:

BlobContainerAsyncClient blobContainerClient = new BlobContainerClientBuilder()
    .connectionString(storageConnectionString)
    .containerName(storageContainerName)
    .buildAsyncClient();

EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder()
    .connectionString(eventHubConnectionString, eventHubName)
    .consumerGroup(consumerGroupName)
    .checkpointStore(new BlobCheckpointStore(blobContainerClient))
    .processEvent(eventContext -> {
        // Process event and checkpoint
        eventContext.updateCheckpoint();
    })
    .processError(errorContext -> {
        System.err.printf("Error in partition %s: %s%n",
            errorContext.getPartitionContext().getPartitionId(),
            errorContext.getThrowable().getMessage());
    })
    .buildEventProcessorClient();

eventProcessorClient.start();

Required imports for migrated code

import com.azure.messaging.eventhubs.EventProcessorClient;
import com.azure.messaging.eventhubs.EventProcessorClientBuilder;
import com.azure.messaging.eventhubs.checkpointstore.blob.BlobCheckpointStore;
import com.azure.storage.blob.BlobContainerAsyncClient;
import com.azure.storage.blob.BlobContainerClientBuilder;

Required dependencies

Add these dependencies when migrating from com.microsoft.azure:azure-eventhubs-eph:

Legacy Artifact Modern Artifact
com.microsoft.azure:azure-eventhubs-eph com.azure:azure-messaging-eventhubs
(included in above) com.azure:azure-messaging-eventhubs-checkpointstore-blob

Source: SKILL.md on GitHub

No alerts15d3 checks · Risk SAFE
  • Gen Agent Trust Hub15d

    This skill provides a structured framework for Azure workload upgrades and Java SDK modernization. It incorporates several security-focused practices, such as mandatory reviews to ensure the preservation of authentication and authorization controls during code migration. The skill utilizes standard development tools and follows official Microsoft guidance for Azure resource management.

  • Socket15d

    No alerts

  • Snyk15d

    Risk: LOW · No issues

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

Last checked against GitHub 20 hours ago.

Activeupdated 2 months ago
compatibility
python3.10+
metadata
{
  "author": "Microsoft",
  "version": "1.2.1"
}

README badge

README badge for microsoft/skills/azure-upgrade