Azure / azure-cli-extensions

Public Repository for Extensions of Azure CLI.
https://docs.microsoft.com/en-us/cli/azure
MIT License
373 stars 1.16k forks source link
azure-cli azure-cli-extension

Extensions for Azure CLI 2.0

This repository serves two purposes and they are independent:

  1. A source code directory, src, to host your extension source code.
  2. An index.json where you can add your extension and make it available through Azure CLI.

For documentation on authoring an extension, see Extension Documentation

About index.json

Add your extension to the index to make it available in these CLI commands:

About source code in this repository

About extension publishing

There is a pipeline to automatically build, upload and publish extension wheels.

Once your PR is merged into master branch, a new PR will be created to update src/index.json automatically.

The precondition is to put your code inside this repo and upgrade the version in the PR but not to modify src/index.json.

If you want to host the source code in your dedicated repo, you have to upload the WHL file and update the src/index.json manually.

For detail, please visit Publish section in Azure CLI Extension Authoring.

FAQ

How to generate sha256digest for an index.json entry?

If you use azdev extension update-index the command will calculate the SHA256 digest for you. For more information visit https://github.com/Azure/azure-cli-dev-tools.

As a fallback:

MacOS

shasum -a 256 path_to_whl.whl

Windows / PowerShell

Get-FileHash path_to_whl.whl -Algorithm SHA256

Note: Hash should be in lowercase in index.json otherwise CI will fail.

How to fill in the metadata for an index.json entry?

The azdev extension update-index command can be used to simplify the process of updating the index file. Run azdev extension update-index <URL> where URL is the fully-qualified URL to your published extension WHL. This will gather the appropriate metadata and add an entry for your extension to the index. For more information visit https://github.com/Azure/azure-cli-dev-tools.

As a fallback:

The metadata needed to be filled is a combination of the contents present in:

Note that CI will fail if this metadata does not match the contents of your published extension.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.