Skip to content

Upgrading Extensions for V2 Compatibility

Alex Weininger edited this page Oct 11, 2022 · 20 revisions

Context

Client extensions will undergo two updates related to the V2 API.

  1. Updates needed to make client extension compatible with V2 API, without actually consuming the V2 API.
  2. Full upgrade and migration to the V2 API. Lots of code changes will be required for this step.

This is a guide for part 1 of the upgrade.

Migrating

Prerequisites

  • Update utils package

Code changes

  • Replace registerCommand uses with registerCommandWithTreeNodeUnwrapping
  • Resolvers must be registered with an AzExtResourceType ID
    • The id argument when calling registerApplicationResourceResolver must be an AzExtResourceType.

Extension manifest updates

  • Add V2 contributions to package.json
    "contributes": {
        "x-azResourcesV2": {
            "application": {
                "branches": [
                    {
                        "type": "FunctionApp" // must match ID used to register the resolver
                    }
                ]
            },
            // needed if extension contributes workspace views
            "workspace": {
                "branches": [
                    {
                        "type": "func" // must match ID used to register the workspace resource provider
                    }
                ],
                "resources": [
                    {
                        "type": "func" // must match ID used to register the workspace resource provider
                    }
                ]
            }
        },
  • Commands should show on azureResourceGroupsV2 view instead of azureResourceGroups view
  • Change commands attached to azureResourceTypeGroup tree items to use AzExtResourceType contexts Example

Use Azure Functions as an example

Testing

Clone this wiki locally