Skip to content

Add edit config and view merged config commands #16943

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 4 commits into
base: main
Choose a base branch
from

Conversation

StephenWeatherford
Copy link
Contributor

@StephenWeatherford StephenWeatherford commented Apr 18, 2025

Fixes #15648

Microsoft Reviewers: Open in CodeFlow

Two new commands in vscode:

Edit configuration

In all context menus
image
Opens up the bicepconfig.json that applies to a bicep file. If none found, asks to create a new one.

View merged configuration

Available only in F1 menu
image
Displays this in output window:

5:21:23 PM: Configuration information for c:\Users\<user>\repos\template-examples\bicep\modules\client\bicepconfig.json:
Configuration file path: c:\Users\<user>\repos\template-examples\bicep\modules\client\bicepconfig.json
Merged with default configuration:
  {
    "cloud": {
      "currentProfile": "AzureCloud",
      "profiles": {
        "AzureChinaCloud": {
          "resourceManagerEndpoint": "https://management.chinacloudapi.cn",
          "activeDirectoryAuthority": "https://login.chinacloudapi.cn"
        },
        "AzureCloud": {
          "resourceManagerEndpoint": "https://management.azure.com",
          "activeDirectoryAuthority": "https://login.microsoftonline.com"
        },
        "AzureUSGovernment": {
          "resourceManagerEndpoint": "https://management.usgovcloudapi.net",
          "activeDirectoryAuthority": "https://login.microsoftonline.us"
        }
      },
      "credentialPrecedence": [
        "AzureCLI",
        "AzurePowerShell"
      ]
    },
    "moduleAliases": {
      "ts": {
        "sawbicep": {
          "subscription": "e5ef2b13-6478-4887-ad57-1aa6b9475040",
          "resourceGroup": "sawbicep"
        }
      },
      "br": {
        "deepsawbicep": {
          "registry": "sawbicep.azurecr.io",
          "modulePath": "misc/deep-stuff/and-deeper/and-deeper/just-right/modules"
        },
        "public": {
          "registry": "mcr.microsoft.com",
          "modulePath": "bicep"
        },
        "sawbicep": {
          "registry": "sawbicep.azurecr.io"
        }
      }
    },
    "extensions": {
      "az": "builtin:",
      "kubernetes": "builtin:"
    },
    "implicitExtensions": [
      "az"
    ],
    "analyzers": {
      "core": {
        "verbose": false,
        "enabled": true,
        "rules": {
          "no-hardcoded-env-urls": {
            "level": "warning",
            "disallowedhosts": [
              "azuredatalakeanalytics.net",
              "azuredatalakestore.net",
              "batch.core.windows.net",
              "core.windows.net",
              "database.windows.net",
              "datalake.azure.net",
              "gallery.azure.com",
              "graph.windows.net",
              "login.microsoftonline.com",
              "management.azure.com",
              "management.core.windows.net",
              "vault.azure.net"
            ],
            "excludedhosts": [
              "schema.management.azure.com"
            ]
          },
          "use-recent-api-versions": {
            "level": "error"
          }
        }
      }
    },
    "experimentalFeaturesEnabled": {
      "symbolicNameCodegen": false,
      "extensibility": false,
      "extendableParamFiles": false,
      "resourceTypedParamsAndOutputs": false,
      "sourceMapping": false,
      "legacyFormatter": false,
      "testFramework": false,
      "assertions": false,
      "waitAndRetry": false,
      "localDeploy": false,
      "resourceInfoCodegen": false,
      "typedVariables": false,
      "moduleExtensionConfigs": false,
      "desiredStateConfiguration": false,
      "externalInputFunction": false,
      "onlyIfNotExists": false
    },
    "formatting": {
      "indentKind": "Space",
      "newlineKind": "LF",
      "insertFinalNewline": true,
      "indentSize": 2,
      "width": 120
    }
  }
Linter rules state (core):
  Analyzer enabled: True
  
  Enabled rules:
    adminusername-should-not-be-literal: Warning (default)
    artifacts-parameters: Warning (default)
    decompiler-cleanup: Warning (default)
    max-asserts: Error (default)
    max-outputs: Error (default)
    max-params: Error (default)
    max-resources: Error (default)
    max-variables: Error (default)
    no-conflicting-metadata: Warning (default)
    no-deployments-resources: Warning (default)
    no-hardcoded-env-urls: Warning (default)
    nested-deployment-template-scoping: Error (default)
    no-unnecessary-dependson: Warning (default)
    no-unused-existing-resources: Warning (default)
    no-unused-params: Warning (default)
    no-unused-vars: Warning (default)
    outputs-should-not-contain-secrets: Warning (default)
    prefer-interpolation: Warning (default)
    prefer-unquoted-property-names: Warning (default)
    protect-commandtoexecute-secrets: Warning (default)
    secure-secrets-in-params: Warning (default)
    secure-parameter-default: Warning (default)
    secure-params-in-nested-deploy: Warning (default)
    simplify-interpolation: Warning (default)
    simplify-json-null: Warning (default)
    use-parent-property: Warning (default)
    use-recent-api-versions: Error
    use-resource-id-functions: Warning (default)
    use-resource-symbol-reference: Warning (default)
    use-safe-access: Warning (default)
    use-secure-value-for-secure-inputs: Warning (default)
    use-stable-resource-identifiers: Warning (default)
    use-stable-vm-image: Warning (default)
    
  Disabled rules:
    explicit-values-for-loc-params: Off (default)
    no-hardcoded-location: Off (default)
    no-loc-expr-outside-params: Off (default)
    use-recent-module-versions: Off (default)
    use-user-defined-types: Off (default)
    what-if-short-circuiting: Off (default)

Copy link
Contributor

github-actions bot commented Apr 18, 2025

Test this change out locally with the following install scripts (Action run 14985304833)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 14985304833
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 14985304833"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 14985304833
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 14985304833"

Copy link
Contributor

github-actions bot commented Apr 18, 2025

Dotnet Test Results

    78 files   -     39      78 suites   - 39   35m 17s ⏱️ - 18m 56s
12 145 tests +   109  12 145 ✅ +   109  0 💤 ±0  0 ❌ ±0 
28 054 runs   - 13 647  28 054 ✅  - 13 647  0 💤 ±0  0 ❌ ±0 

Results for commit d091d44. ± Comparison against base commit 1390409.

This pull request removes 2090 and adds 1025 tests. Note that renamed tests count towards both.

		nestedProp1: 1
		nestedProp2: 2
		prop1: true
		prop2: false
	1
	2
	\$'")
	prop1: true
	prop2: false
…
Bicep.Cli.IntegrationTests.BuildCommandTests ‑ Build_Invalid_SingleFile_ShouldFail_WithExpectedErrorMessage_InvalidExtensions_CRLF
Bicep.Cli.IntegrationTests.BuildCommandTests ‑ Build_Invalid_SingleFile_ToStdOut_ShouldFail_WithExpectedErrorMessage_InvalidExtensions_CRLF
Bicep.Cli.IntegrationTests.BuildParamsCommandTests ‑ Build_Valid_Params_File_Should_Succeed (Files/baselines_bicepparam/TypedVariables/parameters.bicepparam)
Bicep.Cli.IntegrationTests.BuildParamsCommandTests ‑ Build_Valid_Params_File_ToStdOut_Should_Succeed (Files/baselines_bicepparam/TypedVariables/parameters.bicepparam)
Bicep.Cli.IntegrationTests.BuildParamsCommandTests ‑ Build_Valid_Params_File_To_Outdir_Should_Succeed (Files/baselines_bicepparam/TypedVariables/parameters.bicepparam)
Bicep.Cli.IntegrationTests.FormatCommandTests ‑ Format_SampleBicepFile_MatchesFormattedSample_InvalidExtensions_CRLF
Bicep.Cli.IntegrationTests.FormatCommandTests ‑ Format_SampleBicepParam_MatchesFormattedSample (Files/baselines_bicepparam/TypedVariables/parameters.bicepparam)
Bicep.Cli.IntegrationTests.GenerateParamsCommandTests ‑ GenerateParams_UserDefinedTypeParameters_BicepparamFormat_Should_Succeed
Bicep.Cli.IntegrationTests.GenerateParamsCommandTests ‑ GenerateParams_UserDefinedTypeParameters_JsonFormat_Should_Succeed
Bicep.Cli.IntegrationTests.GenerateParamsCommandTests ‑ GenerateParams_UserDefinedTypeParameters_ObjectInObject_BicepparamFormat_Should_Succeed
…

♻️ This comment has been updated with latest results.

@StephenWeatherford StephenWeatherford force-pushed the sw/edit-config branch 2 times, most recently from 561993c to ba5970f Compare April 18, 2025 23:54
@StephenWeatherford StephenWeatherford marked this pull request as ready for review April 19, 2025 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

We need an easy way to figure out where the active bicepconfig.json file is and which rules are currently enabled
1 participant