Skip to content

az functionapp create --environment only works for containerapp environment in the same resource group #30795

Description

@sausagedogcoffee

Describe the bug

When using " az functionapp create" for deploying a function to a containerapp environment, the "--environment" must be in the same resource group as "--resource-group".

--storage-account also used to have this issue but you can reference the full ID to fix it.

Related command

az functionapp create --name functionapp1 --resource-group rg-apps --environment "cae-apps"

Errors

File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 430, in get_managed_environment
azure.cli.core.azclierror.ResourceNotFoundError: Retrieving managed environment failed with an exception:
(ResourceNotFound) The Resource 'Microsoft.App/managedEnvironments/x' under resource group 'rg-x' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Code: ResourceNotFound
Message: The Resource 'Microsoft.App/managedEnvironments/x' under resource group 'rg-x' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
The environment does not exist

cli.azure.cli.core.azclierror: Retrieving managed environment failed with an exception:
(ResourceNotFound) The Resource 'Microsoft.App/managedEnvironments/cae-dev-ae-backend' under resource group 'x' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Code: ResourceNotFound

Issue script & Debug output

File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 430, in get_managed_environment
azure.cli.core.azclierror.ResourceNotFoundError: Retrieving managed environment failed with an exception:
(ResourceNotFound) The Resource 'Microsoft.App/managedEnvironments/x' under resource group 'rg-x' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Code: ResourceNotFound
Message: The Resource 'Microsoft.App/managedEnvironments/x' under resource group 'rg-x' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
The environment does not exist

cli.azure.cli.core.azclierror: Retrieving managed environment failed with an exception:
(ResourceNotFound) The Resource 'Microsoft.App/managedEnvironments/cae-digital-dev-ae-backend' under resource group 'x' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Code: ResourceNotFound

Expected behavior

The function app is deployed to the container app in another resource group, this is what happens when deploying using the portal

Environment Summary

azure-cli 2.67.0 *

core 2.67.0 *
telemetry 1.1.0

Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'

Python (Windows) 3.12.7 (tags/v3.12.7:0b05ead, Oct 1 2024, 03:06:41) [MSC v.1941 64 bit (AMD64)]

Additional context

No response

Metadata

Metadata

Labels

Auto-AssignAuto assign by botAuto-ResolveAuto resolve by botFunctionsaz functionappPossible-SolutionService AttentionThis issue is responsible by Azure service team.Similar-Issueact-observability-squadbugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions