Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

DEV Community

Cover image for Introducing azure.nvim: A Neovim Plugin for Azure Function Management
Edwin Boon
Edwin Boon

Posted on

Introducing azure.nvim: A Neovim Plugin for Azure Function Management

Introducing azure.nvim: A Neovim Plugin for Azure Function Management πŸš€

If you're a Neovim user working with Azure Functions, you know the frustration of constantly switching between your editor and external tools just to manage application settings. While Visual Studio Code users enjoy a seamless experience with the Azure extension, terminal-based editors like Neovim have been left outβ€”until now.

Enter azure.nvim, a lightweight Neovim plugin designed to bring Azure Function App management directly into your favorite editor. No more context switching, no more breaking your workflow.

The Problem: Workflow Interruptions

Working with Azure Function Apps often involves:

  • Accessing application settings for local development
  • Converting Azure settings to the local.settings.json format
  • Troubleshooting configuration issues without leaving your editor

For Neovim users, this typically means switching to the Azure Portal or Azure CLI in a separate terminal window, disrupting focus and productivity.

The Solution: azure.nvim

azure.nvim leverages the Azure CLI to fetch Function App settings and seamlessly converts them into the familiar local.settings.json format. With just a few keystrokes, you can:

  • Retrieve all application settings from any Azure Function App
  • Generate a properly formatted local.settings.json file
  • View settings directly within a Neovim buffer
  • Optionally decrypt sensitive settings (coming soon)

What's New in This Version

The latest release of azure.nvim includes several improvements:

  • Better Error Handling: Improved validation and debugging for Azure CLI commands
  • Interactive Settings: Prompts for Function App name and resource group
  • Proper JSON Formatting: Converts Azure settings to local.settings.json with ease
  • Multiple Output Options: View settings in a buffer or save directly to a file
  • Improved Keybindings: Configurable shortcuts for all plugin functionality

Installation

You can install azure.nvim using your favorite plugin manager.

With Packer.nvim

use({
    "edwinboon/azure.nvim",
    config = function()
        require("azure").setup({
            decrypt = false, -- Enable to decrypt sensitive settings
            keymaps = {
                fetch_app_settings = "<leader>af", -- Customize keybinding
            }
        })
    end,
})
Enter fullscreen mode Exit fullscreen mode

With Lazy.nvim

require("lazy").setup({
    {
        "edwinboon/azure.nvim",
        config = function()
            require("azure").setup({
                decrypt = false,
                keymaps = {
                    fetch_app_settings = "<leader>af",
                }
            })
        end,
    },
})
Enter fullscreen mode Exit fullscreen mode

How It Works

The plugin is built with a clean, modular architecture:

azure.nvim/
β”œβ”€β”€ lua/
β”‚   └── azure/
β”‚       β”œβ”€β”€ fetch.lua  # Core functionality for fetching settings
β”‚       └── init.lua   # Plugin setup and configuration
β”œβ”€β”€ README.md
└── ...
Enter fullscreen mode Exit fullscreen mode

When you trigger the fetch operation (default: <leader>af), the plugin:

  1. Prompts for the Azure Function App name and resource group
  2. Constructs an Azure CLI command to fetch application settings
  3. Executes the command and captures the output
  4. Parses the JSON response and converts it to local.settings.json format
  5. Displays the result in a new Neovim buffer and/or saves it to a file

Example Workflow

  1. Press <leader>af in normal mode
  2. Enter the Azure Function App name when prompted
  3. Enter the resource group when prompted
  4. View the fetched settings in a new buffer
  5. Optionally edit or save the settings as needed

Behind the Scenes

The plugin uses the Azure CLI command az functionapp config appsettings list to fetch settings. It processes the JSON output into this structure:

{
  "IsEncrypted": false,
  "Values": {
    "Setting1": "Value1",
    "Setting2": "Value2",
    ...
  }
}
Enter fullscreen mode Exit fullscreen mode

Future Enhancements

This is just the beginning for azure.nvim. Planned features include:

  • Setting Decryption: Automatically decrypt sensitive settings
  • Upload Capability: Push local settings back to Azure
  • Multiple Function App Support: Save configurations for different apps
  • Diff View: Compare local and Azure settings
  • Azure Key Vault Integration: Directly access secrets from Key Vault

Requirements

  • Neovim 0.5.0 or higher
  • Azure CLI installed and configured (run az login)
  • Lua support in your Neovim configuration

Conclusion

If you're a Neovim user working with Azure Functions, azure.nvim can save you countless context switches and streamline your workflow. Say goodbye to jumping between your editor and the Azure Portal just to check configuration settings.

Give it a try and let me know what you think! Contributions, ideas, and feature requests are welcome on GitHub.

Happy coding! πŸš€

Top comments (0)