Azure / Azure/azure-cli

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

Open
#30,795 6 comments 0 reactions 4 assignees Claimed by @kamperiadis View on GitHub
act-observability-squad Auto-Assign Auto-Resolve bug customer-reported Functions Possible-Solution Service Attention Similar-Issue
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### 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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.