Skip to content

fix(cli): improve error message when deploying Radius types with wrong API version#11557

Merged
willdavsmith merged 10 commits intoradius-project:mainfrom
officialasishkumar:fix/improve-deploy-error-for-wrong-api-version
Apr 30, 2026
Merged

fix(cli): improve error message when deploying Radius types with wrong API version#11557
willdavsmith merged 10 commits intoradius-project:mainfrom
officialasishkumar:fix/improve-deploy-error-for-wrong-api-version

Conversation

@officialasishkumar
Copy link
Copy Markdown
Contributor

Description

When a Bicep template uses a Radius resource type with an unsupported API version (e.g., Radius.Core/applications@2023-10-01-preview), the Bicep compiler cannot resolve the type and treats it as a passthrough ARM resource. The deployment engine then routes it through Azure, producing a misleading error:

"Azure deployment failed, please ensure you have configured an Azure provider with your Radius environment"

This is confusing because the user intended to deploy a Radius resource, not an Azure resource. The actual problem is that the API version is wrong for the given resource type namespace.

This change detects the mismatch between the error (Azure-related) and the template contents (Radius-only resource types) and wraps the error with a clear, actionable message that suggests checking the API version for each resource type. After this change, users will see:

Deployment failed with an Azure provider error, but the template only contains Radius resource types.
This commonly happens when a resource type is used with an incorrect or unsupported API version,
causing it to be misrouted. Please verify that each resource uses a supported API version.

For example, Radius.Core types use API version '2025-08-01-preview' and Applications.Core types use '2023-10-01-preview'.

Changes

  • pkg/cli/bicep/resources.go: Add ExtractResourceTypes, IsRadiusResourceType, and HasOnlyRadiusResourceTypes helpers for template resource type analysis
  • pkg/cli/cmd/deploy/deploy.go: Add addDeploymentErrorContext to detect and contextualize misleading Azure errors for Radius-only templates
  • pkg/cli/bicep/resources_test.go: Add comprehensive unit tests for resource type extraction and classification
  • pkg/cli/cmd/deploy/deploy_test.go: Add unit tests for the error context wrapping logic

Type of change

  • This pull request fixes a bug in Radius and has an approved issue (issue link required).

Fixes: #11462

Contributor checklist

Please verify that the PR meets the following requirements, where applicable:

  • An overview of proposed schema changes is included in a linked GitHub issue.
    • Yes
    • Not applicable
  • A design document PR is created in the design-notes repository, if new APIs are being introduced.
    • Yes
    • Not applicable
  • The design document has been reviewed and approved by Radius maintainers/approvers.
    • Yes
    • Not applicable
  • A PR for the samples repository is created, if existing samples are affected by the changes in this PR.
    • Yes
    • Not applicable
  • A PR for the documentation repository is created, if the changes in this PR affect the documentation or any user facing updates are made.
    • Yes
    • Not applicable
  • A PR for the recipes repository is created, if existing recipes are affected by the changes in this PR.
    • Yes
    • Not applicable

@officialasishkumar officialasishkumar requested review from a team as code owners April 5, 2026 18:53
Copilot AI review requested due to automatic review settings April 5, 2026 18:53
@officialasishkumar officialasishkumar requested a deployment to external-contributor-approval April 5, 2026 18:53 — with GitHub Actions Waiting
Copy link
Copy Markdown
Contributor

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

This PR improves the rad deploy UX when a Radius resource type is used with an unsupported/incorrect API version and is consequently misrouted through Azure, producing a misleading “configure an Azure provider” error.

Changes:

  • Wrap misleading Azure-related deployment errors with actionable context when the compiled template contains only Radius resource types.
  • Add Bicep template helpers to extract and classify resource types (Radius vs non-Radius).
  • Add unit tests covering resource type extraction/classification and the deployment error wrapping behavior.

Reviewed changes

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

File Description
pkg/cli/cmd/deploy/deploy.go Wraps Azure-related deployment errors with additional context when the template contains only Radius types.
pkg/cli/cmd/deploy/deploy_test.go Adds unit tests validating when deployment errors are wrapped vs returned unchanged.
pkg/cli/bicep/resources.go Adds helpers to extract resource types and detect whether a template contains only Radius resource types.
pkg/cli/bicep/resources_test.go Adds unit tests for resource type extraction and Radius-namespace classification.

@officialasishkumar officialasishkumar requested a deployment to external-contributor-approval April 5, 2026 19:16 — with GitHub Actions Waiting
@willdavsmith willdavsmith self-requested a review April 6, 2026 18:24
Copy link
Copy Markdown
Contributor

@willdavsmith willdavsmith left a comment

Choose a reason for hiding this comment

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

thanks for the contribution! added a couple of comments

Comment thread pkg/cli/cmd/deploy/deploy.go Outdated
Comment thread pkg/cli/cmd/deploy/deploy.go Outdated
Comment thread pkg/cli/bicep/resources.go Outdated
@officialasishkumar officialasishkumar force-pushed the fix/improve-deploy-error-for-wrong-api-version branch from 30aa590 to c309c98 Compare April 7, 2026 05:56
@officialasishkumar officialasishkumar requested a deployment to external-contributor-approval April 7, 2026 05:56 — with GitHub Actions Waiting
@officialasishkumar officialasishkumar force-pushed the fix/improve-deploy-error-for-wrong-api-version branch from c309c98 to 5ff6b46 Compare April 7, 2026 06:06
@officialasishkumar officialasishkumar requested a deployment to external-contributor-approval April 7, 2026 06:06 — with GitHub Actions Waiting
@officialasishkumar officialasishkumar requested a deployment to external-contributor-approval April 7, 2026 21:19 — with GitHub Actions Waiting
@officialasishkumar officialasishkumar requested a deployment to external-contributor-approval April 7, 2026 21:46 — with GitHub Actions Waiting
Copy link
Copy Markdown
Contributor

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

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

Comment thread pkg/cli/cmd/deploy/deploy.go Outdated
Comment thread pkg/cli/cmd/deploy/deploy.go Outdated
Comment thread pkg/cli/bicep/resources.go Outdated
Comment thread pkg/cli/cmd/deploy/deploy_test.go
Copy link
Copy Markdown
Contributor

@willdavsmith willdavsmith left a comment

Choose a reason for hiding this comment

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

Looks pretty good to me. Can you address the copilot comments and add sign-offs to the commits to resolve DCO?

@officialasishkumar officialasishkumar force-pushed the fix/improve-deploy-error-for-wrong-api-version branch from 474b2a1 to cf1a623 Compare April 16, 2026 04:53
@officialasishkumar officialasishkumar requested a deployment to external-contributor-approval April 16, 2026 04:53 — with GitHub Actions Waiting
@officialasishkumar
Copy link
Copy Markdown
Contributor Author

officialasishkumar commented Apr 16, 2026

Addressed the remaining review feedback in cf1a6236a

@officialasishkumar officialasishkumar requested a deployment to external-contributor-approval April 16, 2026 14:36 — with GitHub Actions Waiting
officialasishkumar and others added 4 commits April 16, 2026 20:07
…g API version

When a Bicep template uses a Radius resource type with an unsupported
API version (e.g., Radius.Core/applications@2023-10-01-preview), the
Bicep compiler cannot resolve the type and treats it as a passthrough
ARM resource. The deployment engine then routes it through Azure,
producing a misleading error: "Azure deployment failed, please ensure
you have configured an Azure provider."

This change detects the mismatch between the error (Azure-related) and
the template contents (Radius-only resource types) and wraps the error
with a clear, actionable message that suggests checking the API version
for each resource type.

Changes:
- Add ExtractResourceTypes, IsRadiusResourceType, and
  HasOnlyRadiusResourceTypes helpers to pkg/cli/bicep/resources.go
- Add addDeploymentErrorContext to the deploy command to detect and
  contextualize misleading Azure errors for Radius-only templates
- Add comprehensive unit tests for all new functions

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Match on the exact Deployment Engine error pattern instead of
hardcoding "azure" in string matching. Change resource type
namespace list to use Applications.* and Radius.* patterns.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
@officialasishkumar officialasishkumar force-pushed the fix/improve-deploy-error-for-wrong-api-version branch from b2203af to 4a6ebae Compare April 16, 2026 14:37
@officialasishkumar officialasishkumar requested a deployment to external-contributor-approval April 16, 2026 14:37 — with GitHub Actions Waiting
@willdavsmith willdavsmith self-requested a review April 20, 2026 17:00
@willdavsmith willdavsmith temporarily deployed to external-contributor-approval April 20, 2026 17:06 — with GitHub Actions Inactive
@nicolejms nicolejms temporarily deployed to external-contributor-approval April 21, 2026 21:00 — with GitHub Actions Inactive
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 82.14286% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.45%. Comparing base (ec789e8) to head (a58fa3b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/cli/cmd/deploy/deploy.go 70.45% 7 Missing and 6 partials ⚠️
pkg/cli/bicep/resources.go 95.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11557      +/-   ##
==========================================
+ Coverage   51.40%   51.45%   +0.05%     
==========================================
  Files         699      699              
  Lines       44036    44119      +83     
==========================================
+ Hits        22638    22703      +65     
- Misses      19244    19253       +9     
- Partials     2154     2163       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@willdavsmith willdavsmith temporarily deployed to external-contributor-approval April 22, 2026 17:35 — with GitHub Actions Inactive
@nithyatsu nithyatsu requested a deployment to external-contributor-approval April 27, 2026 18:11 — with GitHub Actions Waiting
@willdavsmith willdavsmith temporarily deployed to external-contributor-approval April 30, 2026 17:24 — with GitHub Actions Inactive
@radius-functional-tests
Copy link
Copy Markdown

radius-functional-tests Bot commented Apr 30, 2026

Radius functional test overview

🔍 Go to test action run

Click here to see the test run details
Name Value
Repository officialasishkumar/radius
Commit ref a58fa3b
Unique ID func0a6da1cf9e
Image tag pr-func0a6da1cf9e
  • gotestsum 1.13.0
  • KinD: v0.29.0
  • Dapr: 1.14.4
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func0a6da1cf9e
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func0a6da1cf9e
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func0a6da1cf9e
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func0a6da1cf9e
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func0a6da1cf9e
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@willdavsmith willdavsmith merged commit 2b66ff8 into radius-project:main Apr 30, 2026
57 checks passed
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.

Incorrect error message when deploying Radius.Core/Applications with wrong API version

5 participants