-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Related command
az pipelines variable-group create
az pipelines variable-group variable create
Is your feature request related to a problem? Please describe.
Currently, Azure DevOps Library supports exporting variable groups to JSON format, but there's no corresponding import functionality through Azure CLI commands. This creates an asymmetrical workflow where users can export their variable configurations but cannot easily import them back or migrate variables between environments/organizations. This limitation forces users to manually recreate variable groups or use workarounds, which is time-consuming and error-prone, especially when dealing with large numbers of variables or complex deployment scenarios.
Describe the solution you'd like
add an --import-from-json or --from-file parameter to the az pipelines variable-group create command that would accept a JSON file in the same format that's generated by the export functionality. The command should:
- Parse the JSON file containing variable definitions
- Create a new variable group with the imported variables
- Support both regular and secret variables (with appropriate security handling) - you can define that secret field will be with default variable blank
- Provide validation and error handling for malformed JSON files
- Maintain compatibility with the existing export format
Example usage:
az pipelines variable-group create --organization {org} --project {project} --name "Imported Variables" --from-file variables.json
Describe alternatives you've considered
Using REST API directly (requires more complex scripting and authentication setup)
Manual recreation through Azure DevOps web interface (time-consuming and error-prone)
Additional context
This feature would significantly improve the DevOps workflow by enabling:
- Easy backup and restore of variable configurations
- Simplified migration between Azure DevOps organizations/projects
- Version control of variable group configurations
- Automated deployment scenarios where variable groups need to be created programmatically
- Better consistency between development, staging, and production environments
But, feature should maintain security best practices for secret variables and provide clear documentation on the expected JSON schema format.