azure-dev: Multiple Resource Group Support --> Unable to deploy Azure Function app

Output from az dev version azd version 0.0.1-beta.1588565 (commit 1b0d7eba856333b956b09e929666838dbf2df5e9)

Describe the bug Unable to deploy code to Azure Function app.

To Reproduce

  • Execute azd init on existing project.
  • Add content to the azure.yaml file
    name: gridwich-ocw22
    services:
    fn:
       project: src/Gridwich.Host.FunctionApp/src
       resourceName: gridwichfxn${GRIDWICH_ENVIRONMENT}
       language: csharp
       host: function
    
  • Azure Function code is located at C:\source\msft\gridwich-ocw22\src\Gridwich.Host.FunctionApp.
  • Execute azd deploy --debug from C:\source\msft\gridwich-ocw22 via a Visual Studio Code terminal.

Expected behavior Azure Dev CLI should successfully deploy code to a provisioned Azure Function app. If the deployment is unsuccessful, the Azure Dev CLI should return an actionable error message (clear error message, suggestions to resolve, suggestions to learn more, etc.)

Environment Information on your environment: * .NET version: 3.1.417 * Windows: Version 22H2 (OS Build 22621.1) * PowerShell: 7.2.4 * Azure CLI: 2.36.0

Additional context

Running the azd deploy --debug command produces the following output:

2022/05/20 14:17:39 executil.go:235: Cmd: az account list --output json --query [].{name:name, id:id, isDefault:isDefault} --debug
Out:[
  {
   // List of Azure subscriptions removed.
  }
]

Err:DEBUG: cli.knack.cli: Command arguments: ['account', 'list', '--output', 'json', '--query', '[].{name:name, id:id, isDefault:isDefault}', '--debug']
DEBUG: cli.knack.cli: __init__ debug log:
Cannot enable color.
DEBUG: cli.knack.cli: Event: Cli.PreExecute []
DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x03D28CD0>, <function OutputProducer.on_global_arguments at 0x03EED610>, <function CLIQuery.on_global_arguments at 0x03F0B268>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
DEBUG: cli.azure.cli.core: Modules found from index for 'account': ['azure.cli.command_modules.profile', 'azure.cli.command_modules.resource']
DEBUG: cli.azure.cli.core: Loading command modules:
DEBUG: cli.azure.cli.core: Name                  Load Time    Groups  Commands
DEBUG: cli.azure.cli.core: profile                   0.007         2         9
DEBUG: cli.azure.cli.core: resource                  0.012        43       197
DEBUG: cli.azure.cli.core: Total (2)                 0.019        45       206
DEBUG: cli.azure.cli.core: Loaded 44 groups, 206 commands.
DEBUG: cli.azure.cli.core: Found a match in the command table.
DEBUG: cli.azure.cli.core: Raw command  : account list
DEBUG: cli.azure.cli.core: Command table: account list
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x0499C190>]
DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\mcollier\.azure\commands\2022-05-20.14-17-39.account_list.62144.log'.
INFO: az_command_data_logger: command args: account list --output {} --query {} --debug
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x049D3F10>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x049E3028>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x049EB4F0>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x03EED658>, <function CLIQuery.handle_query_parameter at 0x03F0B2B0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x049EB538>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x049D31D8>, <function _x509_from_base64_to_hex_transform at 0x049D3220>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnFilterResult [<function CLIQuery.handle_query_parameter.<locals>.filter_output at 0x04AE45C8>]
DEBUG: cli.knack.cli: Event: Cli.SuccessfulExecute []
DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x0499C2B0>]
INFO: az_command_data_logger: exit code: 0
INFO: cli.__main__: Command ran in 0.841 seconds (init: 0.766, invoke: 0.075)
INFO: telemetry.save: Save telemetry record of length 2929 in cache
INFO: telemetry.check: Returns Positive.
INFO: telemetry.main: Begin creating telemetry upload process.
INFO: telemetry.process: Creating upload process: "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry\__init__.pyc C:\Users\mcollier\.azure"
INFO: telemetry.process: Return from creating process
INFO: telemetry.main: Finish creating telemetry upload process.

2022/05/20 14:17:39 service.go:33: packing service fn
Deploying service fn -2022/05/20 14:18:45 service.go:40: deploying service fn
Deployed service fn
Error: Command Failed: deploying service fn: deploying service fn package: exit status 3

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

Is there a way to tell the Az Dev CLI to deploy a function to a specific Function app in a specific resource group? Or, to put another way, is there a way to specify the target function app? I think what’s happening is that my main.bicep creates multiple resource groups, each with various resources.

Ahh yes - that is very likely the problem. Thanks for digging in @mcollier! This is more or less Azure/azure-dev-issue-transfer#133, which we don’t have an answer for today.

I think it would be quick for us to add a resourceGroup parameter to each service for azure.yaml that would allow you to control this. Longer team, we may be able to make this smarter by looking at the resources for your deployment and doing a match just by app service name. But that’s a bit larger undertaking, and I suspect we would want a way to set this explicitly as well.