Skip to content

Anapandey/bicep export #28014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

anamikapan
Copy link
Member

@anamikapan anamikapan commented Jun 24, 2025

Description

Powershell changes for bicep export feature

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

@Copilot Copilot AI review requested due to automatic review settings June 24, 2025 05:17
Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for exporting resource group templates as Bicep files by introducing an OutputFormat parameter in the cmdlet, updating file-saving logic to handle different extensions, and adding tests for the new behavior.

  • Introduce OutputFormat in ExportAzureResourceGroupCmdlet and pass it to export parameters
  • Extend FileUtility.SaveTemplateFile with an extension argument to choose “.json” or “.bicep”
  • Add PowerShell and C# tests for Bicep export

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Resources/Resources.Test/ScenarioTests/ResourceGroupTests.ps1 Added Test-ExportResourceGroupBicep Pester scenario
src/Resources/Resources.Test/ScenarioTests/ResourceGroupTests.cs Added [Fact] TestExportResourceGroupBicep
src/Resources/ResourceManager/Utilities/FileUtility.cs Extended SaveTemplateFile signature with extension
src/Resources/ResourceManager/Implementation/ResourceGroups/ExportAzureResourceGroupCmdlet.cs Added OutputFormat param and computed extension logic
src/Resources/ResourceManager/Entities/ResourceGroup/ExportTemplateParameters.cs Introduced OutputFormat property for SDK parameters
Comments suppressed due to low confidence (2)

src/Resources/ResourceManager/Utilities/FileUtility.cs:39

  • The XML doc comments above this method no longer match the signature. Please add a <param name="extension"> entry explaining the new argument.
        public static string SaveTemplateFile(string templateName, string contents, string outputPath, bool overwrite, Func<string, string, bool> shouldContinue, string extension = ".json") // Added extension parameter with default

src/Resources/ResourceManager/Entities/ResourceGroup/ExportTemplateParameters.cs:39

  • Consider using the ExportTemplateOutputFormat enum here instead of a plain string for stronger typing and to prevent invalid values at compile time.
        public string OutputFormat { get; set; }

@vidai-msft
Copy link
Contributor

/azp run

Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Contributor

@vidai-msft vidai-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of issues in this PR.

  1. New test case was added but the test recording file is missing.
  2. New parameters were added but the docs has no update.
  3. ChangeLog.md has no update.

@YanaXu
Copy link
Contributor

YanaXu commented Jun 24, 2025

Hi @anamikapan, please update the PR title to describe the purpose of the change and add the test recording file.

@YanaXu YanaXu self-assigned this Jun 24, 2025
Copy link

This PR was labeled "needs-revision" because it has unresolved review comments or CI failures.
Please resolve all open review comments and make sure all CI checks are green. Refer to our guide to troubleshoot common CI failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants