Skip to content
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

Feature/sjad #4473

Draft
wants to merge 170 commits into
base: main
Choose a base branch
from
Draft

Feature/sjad #4473

wants to merge 170 commits into from

Conversation

rujche and others added 30 commits September 6, 2024 13:55
Support adding MySQL when run `azd init`
Fix typo by changing "DbMysql" to "DbMySql"
…or like this: "argetTypeNotSupported: Target resource type MICROSOFT.DBFORMYSQL/FLEXIBLESERVERS is not supported.".
2. Delete '1>&2' used for debug.
3. Add 'az tag create' to fix the problem about tag been deleted when creating service connector.
Use managed-identity instead of username and password
2. Update log about "failed to read spring application properties".
3. Fix bug about can not find frontend app and backend app at the same time.
4. Add service connector from aca to postgresql.
Use passwordless to connect to PostgreSQL in Azure Container Apps
…ble project (#103)

* pre-check if it's a runnable project

* when parent detection, add module check

* fix UT

* fix UT

* fix UT

* fix comments, and update the module check recursively

* make pom artifact id is not same as the dir name

* small fix

* fix UT

* small fix

* clear mvn wrapper content

* deprecate maven build hook, run mvn clean package before adding default dockerfile

* remove unnecessary mvn wrapper files

* remove unused func

* fix UT and remove currentPomDir

* introduce modulePoms

* remove unused func, and refactor

---------

Co-authored-by: haozhang <[email protected]>
@JeffreyCA
Copy link
Contributor

@saragluna I noticed the azd add command is crashing when I add a database:

C:\Users\jc\Documents\Dev\azd-compose>azd init

Initializing an app to run on Azure (azd init)

? How do you want to initialize your app? Create a minimal project
? What is the name of your project? (azd-compose)

? What is the name of your project? azd-compose

SUCCESS: Generated azure.yaml project file.
Run azd add to add new Azure components to your project

C:\Users\jc\Documents\Dev\azd-compose>azd add
? Enter a new environment name: env
? What would you like to add? Database
? Which type of database? MongoDB
? Input the databaseName for MongoDB (Not databaseServerName. This url can explain the difference: 'jdbc:mysql://databaseServerName:3306/databaseName'): [? for help] mydatabase
? Input the databaseName for MongoDB (Not databaseServerName. This url can explain the difference: 'jdbc:mysql://databaseServerName:3306/databaseName'): mydatabase
panic: interface conversion: interface {} is nil, not project.MongoDBProps [recovered]
        panic: interface conversion: interface {} is nil, not project.MongoDBProps

goroutine 1 [running]:
github.com/braydonk/yaml.handleErr(0xc00050ea00)
        C:/Users/jc/go/pkg/mod/github.com/braydonk/[email protected]/yaml.go:344 +0x6d
panic({0x1c77120?, 0xc00061e000?})
        C:/Program Files/Go/src/runtime/panic.go:785 +0x132
github.com/azure/azure-dev/cli/azd/pkg/project.(*ResourceConfig).MarshalYAML(0x1c7a5a0?)
        C:/Users/jc/Documents/Dev/azd-java/cli/azd/pkg/project/resources.go:129 +0x87d
github.com/braydonk/yaml.(*encoder).marshal(0xc000618008, {0x0, 0x0}, {0x1c7a5a0?, 0xc0003853e0?, 0x6168706c612f7361?})
        C:/Users/jc/go/pkg/mod/github.com/braydonk/[email protected]/encode.go:143 +0x8a2
github.com/braydonk/yaml.(*encoder).marshalDoc(0xc000618008, {0x0, 0x0}, {0x1c7a5a0?, 0xc0003853e0?, 0xed5ce5?})
        C:/Users/jc/go/pkg/mod/github.com/braydonk/[email protected]/encode.go:108 +0x12e
github.com/braydonk/yaml.(*Node).Encode(0xc000612140, {0x1c7a5a0, 0xc0003853e0})
        C:/Users/jc/go/pkg/mod/github.com/braydonk/[email protected]/yaml.go:264 +0x32e
github.com/azure/azure-dev/cli/azd/pkg/yamlnode.Encode({0x1c7a5a0, 0xc0003853e0})
        C:/Users/jc/Documents/Dev/azd-java/cli/azd/pkg/yamlnode/yamlnode.go:160 +0x3c
github.com/azure/azure-dev/cli/azd/internal/cmd/add.(*AddAction).Run(0xc0002ed560, {0x209eec0, 0xc0002dc150})
        C:/Users/jc/Documents/Dev/azd-java/cli/azd/internal/cmd/add/add.go:161 +0xced
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x209eec0, 0xc0002dc150})
        C:/Users/jc/Documents/Dev/azd-java/cli/azd/cmd/middleware/middleware.go:126 +0x434
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*TelemetryMiddleware).Run(0xc0002c0c80, {0x209eec0, 0xc0002ad0b0}, 0xc0002c21c0)
        C:/Users/jc/Documents/Dev/azd-java/cli/azd/cmd/middleware/telemetry.go:78 +0x8ee
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x209eec0, 0xc0002ad0b0})
        C:/Users/jc/Documents/Dev/azd-java/cli/azd/cmd/middleware/middleware.go:109 +0x2b8
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*UxMiddleware).Run(0xc000009de8, {0x209eec0, 0xc0002ad0b0}, 0xc0002c21c0)
        C:/Users/jc/Documents/Dev/azd-java/cli/azd/cmd/middleware/ux.go:32 +0xa9
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x209eec0, 0xc0002ad0b0})
        C:/Users/jc/Documents/Dev/azd-java/cli/azd/cmd/middleware/middleware.go:109 +0x2b8
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*DebugMiddleware).Run(0xc000009db8, {0x209eec0, 0xc0002ad0b0}, 0xc0002c21c0)
        C:/Users/jc/Documents/Dev/azd-java/cli/azd/cmd/middleware/debug.go:48 +0x382
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x209eec0, 0xc0002ad0b0})
        C:/Users/jc/Documents/Dev/azd-java/cli/azd/cmd/middleware/middleware.go:109 +0x2b8
github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction(0xc0002b88c0, {0x209eec0, 0xc0002ad0b0}, 0xc0002a3320, {0xc0002be5e0, 0xe})
        C:/Users/jc/Documents/Dev/azd-java/cli/azd/cmd/middleware/middleware.go:130 +0x137
github.com/azure/azure-dev/cli/azd/cmd.(*CobraBuilder).configureActionResolver.func1(0xc00040f8c8, {0x2983280, 0x0, 0x0})
        C:/Users/jc/Documents/Dev/azd-java/cli/azd/cmd/cobra_builder.go:130 +0x386
github.com/spf13/cobra.(*Command).execute(0xc00040f8c8, {0x2983280, 0x0, 0x0})
        C:/Users/jc/go/pkg/mod/github.com/spf13/[email protected]/command.go:856 +0x68a
github.com/spf13/cobra.(*Command).ExecuteC(0xc0003638c8)
        C:/Users/jc/go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x38d
github.com/spf13/cobra.(*Command).Execute(...)
        C:/Users/jc/go/pkg/mod/github.com/spf13/[email protected]/command.go:902
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        C:/Users/jc/go/pkg/mod/github.com/spf13/[email protected]/command.go:895
main.main()
        C:/Users/jc/Documents/Dev/azd-java/cli/azd/main.go:65 +0x24b

C:\Users\jc\Documents\Dev\azd-compose>

This happens with both MongoDB and PostgreSQL. Is this a known issue?

@saragluna
Copy link
Member Author

@JeffreyCA, thanks for the update, will fix it soon

@azure-sdk
Copy link
Collaborator

Azure Dev CLI Install Instructions

Install scripts

MacOS/Linux

May elevate using sudo on some platforms and configurations

bash:

curl -fsSL https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/4473/uninstall-azd.sh | bash;
curl -fsSL https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/4473/install-azd.sh | bash -s -- --base-url https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/4473 --version '' --verbose --skip-verify

pwsh:

Invoke-RestMethod 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/4473/uninstall-azd.ps1' -OutFile uninstall-azd.ps1; ./uninstall-azd.ps1
Invoke-RestMethod 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/4473/install-azd.ps1' -OutFile install-azd.ps1; ./install-azd.ps1 -BaseUrl 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/4473' -Version '' -SkipVerify -Verbose

Windows

PowerShell install

powershell -c "Set-ExecutionPolicy Bypass Process; irm 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/4473/uninstall-azd.ps1' > uninstall-azd.ps1; ./uninstall-azd.ps1;"
powershell -c "Set-ExecutionPolicy Bypass Process; irm 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/4473/install-azd.ps1' > install-azd.ps1; ./install-azd.ps1 -BaseUrl 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/4473' -Version '' -SkipVerify -Verbose;"

MSI install

powershell -c "irm 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/4473/azd-windows-amd64.msi' -OutFile azd-windows-amd64.msi; msiexec /i azd-windows-amd64.msi /qn"

Standalone Binary

MSI

Documentation

learn.microsoft.com documentation

title: Azure Developer CLI reference
description: This article explains the syntax and parameters for the various Azure Developer CLI commands.
author: alexwolfmsft
ms.author: alexwolf
ms.date: 01/13/2025
ms.service: azure-dev-cli
ms.topic: conceptual
ms.custom: devx-track-azdevcli

Azure Developer CLI reference

This article explains the syntax and parameters for the various Azure Developer CLI commands.

azd

The Azure Developer CLI (azd) is an open-source tool that helps onboard and manage your application on Azure

Options

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --docs         Opens the documentation for azd in your web browser.
  -h, --help         Gets help for azd.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

  • azd add: Add a component to your project. (Alpha)
  • azd auth: Authenticate with Azure.
  • azd config: Manage azd configurations (ex: default Azure subscription, location).
  • azd deploy: Deploy the application's code to Azure.
  • azd down: Delete Azure resources for an application.
  • azd env: Manage environments.
  • azd hooks: Develop, test and run hooks for an application. (Beta)
  • azd infra: Manage your Azure infrastructure.
  • azd init: Initialize a new application.
  • azd monitor: Monitor a deployed application. (Beta)
  • azd package: Packages the application's code to be deployed to Azure. (Beta)
  • azd pipeline: Manage and configure your deployment pipelines. (Beta)
  • azd provision: Provision the Azure resources for an application.
  • azd restore: Restores the application's dependencies. (Beta)
  • azd show: Display information about your app and its resources.
  • azd template: Find and view template details. (Beta)
  • azd up: Provision Azure resources, and deploy your project with a single command.
  • azd version: Print the version number of Azure Developer CLI.

azd add

Add a component to your project. (Alpha)

azd add [flags]

Options

      --docs   Opens the documentation for azd add in your web browser.
  -h, --help   Gets help for add.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd auth

Authenticate with Azure.

Options

      --docs   Opens the documentation for azd auth in your web browser.
  -h, --help   Gets help for auth.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd auth login

Log in to Azure.

Synopsis

Log in to Azure.

When run without any arguments, log in interactively using a browser. To log in using a device code, pass
--use-device-code.

To log in as a service principal, pass --client-id and --tenant-id as well as one of: --client-secret,
--client-certificate, or --federated-credential-provider.

To log in using a managed identity, pass --managed-identity, which will use the system assigned managed identity.
To use a user assigned managed identity, pass --client-id in addition to --managed-identity with the client id of
the user assigned managed identity you wish to use.

azd auth login [flags]

Options

      --check-status                           Checks the log-in status instead of logging in.
      --client-certificate string              The path to the client certificate for the service principal to authenticate with.
      --client-id string                       The client id for the service principal to authenticate with.
      --client-secret string                   The client secret for the service principal to authenticate with. Set to the empty string to read the value from the console.
      --docs                                   Opens the documentation for azd auth login in your web browser.
      --federated-credential-provider string   The provider to use to acquire a federated token to authenticate with.
  -h, --help                                   Gets help for login.
      --managed-identity                       Use a managed identity to authenticate.
      --redirect-port int                      Choose the port to be used as part of the redirect URI during interactive login.
      --tenant-id string                       The tenant id or domain name to authenticate with.
      --use-device-code[=true]                 When true, log in by using a device code instead of a browser.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd auth logout

Log out of Azure.

Synopsis

Log out of Azure

azd auth logout [flags]

Options

      --docs   Opens the documentation for azd auth logout in your web browser.
  -h, --help   Gets help for logout.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd config

Manage azd configurations (ex: default Azure subscription, location).

Synopsis

Manage the Azure Developer CLI user configuration, which includes your default Azure subscription and location.

Available since azure-dev-cli_0.4.0-beta.1.

The easiest way to configure azd for the first time is to run azd init. The subscription and location you select will be stored in the config.json file located in the config directory. To configure azd anytime afterwards, you'll use azd config set.

The default value of the config directory is:

  • $HOME/.azd on Linux and macOS
  • %USERPROFILE%.azd on Windows

The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable.

Options

      --docs   Opens the documentation for azd config in your web browser.
  -h, --help   Gets help for config.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd config get

Gets a configuration.

Synopsis

Gets a configuration in the configuration path.

The default value of the config directory is:

  • $HOME/.azd on Linux and macOS
  • %USERPROFILE%\.azd on Windows

The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable.

azd config get <path> [flags]

Options

      --docs   Opens the documentation for azd config get in your web browser.
  -h, --help   Gets help for get.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd config list-alpha

Display the list of available features in alpha stage.

azd config list-alpha [flags]

Options

      --docs   Opens the documentation for azd config list-alpha in your web browser.
  -h, --help   Gets help for list-alpha.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd config reset

Resets configuration to default.

Synopsis

Resets all configuration in the configuration path.

The default value of the config directory is:

  • $HOME/.azd on Linux and macOS
  • %USERPROFILE%\.azd on Windows

The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable to the default.

azd config reset [flags]

Options

      --docs    Opens the documentation for azd config reset in your web browser.
  -f, --force   Force reset without confirmation.
  -h, --help    Gets help for reset.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd config set

Sets a configuration.

Synopsis

Sets a configuration in the configuration path.

The default value of the config directory is:

  • $HOME/.azd on Linux and macOS
  • %USERPROFILE%\.azd on Windows

The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable.

azd config set <path> <value> [flags]

Examples

azd config set defaults.subscription <yourSubscriptionID>
azd config set defaults.location eastus

Options

      --docs   Opens the documentation for azd config set in your web browser.
  -h, --help   Gets help for set.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd config show

Show all the configuration values.

Synopsis

Show all configuration values in the configuration path.

The default value of the config directory is:

  • $HOME/.azd on Linux and macOS
  • %USERPROFILE%\.azd on Windows

The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable.

azd config show [flags]

Options

      --docs   Opens the documentation for azd config show in your web browser.
  -h, --help   Gets help for show.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd config unset

Unsets a configuration.

Synopsis

Removes a configuration in the configuration path.

The default value of the config directory is:

  • $HOME/.azd on Linux and macOS
  • %USERPROFILE%\.azd on Windows

The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable.

azd config unset <path> [flags]

Examples

azd config unset defaults.location

Options

      --docs   Opens the documentation for azd config unset in your web browser.
  -h, --help   Gets help for unset.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd deploy

Deploy the application's code to Azure.

azd deploy <service> [flags]

Options

      --all                   Deploys all services that are listed in azure.yaml
      --docs                  Opens the documentation for azd deploy in your web browser.
  -e, --environment string    The name of the environment to use.
      --from-package string   Deploys the packaged service located at the provided path. Supports zipped file packages (file path) or container images (image tag).
  -h, --help                  Gets help for deploy.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd down

Delete Azure resources for an application.

azd down [flags]

Options

      --docs                 Opens the documentation for azd down in your web browser.
  -e, --environment string   The name of the environment to use.
      --force                Does not require confirmation before it deletes resources.
  -h, --help                 Gets help for down.
      --purge                Does not require confirmation before it permanently deletes resources that are soft-deleted by default (for example, key vaults).

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd env

Manage environments.

Options

      --docs   Opens the documentation for azd env in your web browser.
  -h, --help   Gets help for env.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd env get-value

Get specific environment value.

azd env get-value <keyName> [flags]

Options

      --docs                 Opens the documentation for azd env get-value in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for get-value.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd env get-values

Get all environment values.

azd env get-values [flags]

Options

      --docs                 Opens the documentation for azd env get-values in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for get-values.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd env list

List environments.

azd env list [flags]

Options

      --docs   Opens the documentation for azd env list in your web browser.
  -h, --help   Gets help for list.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd env new

Create a new environment and set it as the default.

azd env new <environment> [flags]

Options

      --docs                  Opens the documentation for azd env new in your web browser.
  -h, --help                  Gets help for new.
  -l, --location string       Azure location for the new environment
      --subscription string   Name or ID of an Azure subscription to use for the new environment

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd env refresh

Refresh environment settings by using information from a previous infrastructure provision.

azd env refresh <environment> [flags]

Options

      --docs                 Opens the documentation for azd env refresh in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for refresh.
      --hint string          Hint to help identify the environment to refresh

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd env select

Set the default environment.

azd env select <environment> [flags]

Options

      --docs   Opens the documentation for azd env select in your web browser.
  -h, --help   Gets help for select.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd env set

Manage your environment settings.

azd env set <key> <value> [flags]

Options

      --docs                 Opens the documentation for azd env set in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for set.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd hooks

Develop, test and run hooks for an application. (Beta)

Options

      --docs   Opens the documentation for azd hooks in your web browser.
  -h, --help   Gets help for hooks.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd hooks run

Runs the specified hook for the project and services

azd hooks run <name> [flags]

Options

      --docs                 Opens the documentation for azd hooks run in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for run.
      --platform string      Forces hooks to run for the specified platform.
      --service string       Only runs hooks for the specified service.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd infra

Manage your Azure infrastructure.

Options

      --docs   Opens the documentation for azd infra in your web browser.
  -h, --help   Gets help for infra.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd infra synth

Write IaC for your project to disk, allowing you to manage it by hand. (Alpha)

azd infra synth [flags]

Options

      --docs                 Opens the documentation for azd infra synth in your web browser.
  -e, --environment string   The name of the environment to use.
      --force                Overwrite any existing files without prompting
  -h, --help                 Gets help for synth.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd init

Initialize a new application.

azd init [flags]

Options

  -b, --branch string         The template branch to initialize from. Must be used with a template argument (--template or -t).
      --docs                  Opens the documentation for azd init in your web browser.
  -e, --environment string    The name of the environment to use.
  -f, --filter strings        The tag(s) used to filter template results. Supports comma-separated values.
      --from-code             Initializes a new application from your existing code.
  -h, --help                  Gets help for init.
  -l, --location string       Azure location for the new environment
  -s, --subscription string   Name or ID of an Azure subscription to use for the new environment
  -t, --template string       Initializes a new application from a template. You can use Full URI, <owner>/<repository>, or <repository> if it's part of the azure-samples organization.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd monitor

Monitor a deployed application. (Beta)

azd monitor [flags]

Options

      --docs                 Opens the documentation for azd monitor in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for monitor.
      --live                 Open a browser to Application Insights Live Metrics. Live Metrics is currently not supported for Python apps.
      --logs                 Open a browser to Application Insights Logs.
      --overview             Open a browser to Application Insights Overview Dashboard.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd package

Packages the application's code to be deployed to Azure. (Beta)

azd package <service> [flags]

Options

      --all                  Packages all services that are listed in azure.yaml
      --docs                 Opens the documentation for azd package in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for package.
      --output-path string   File or folder path where the generated packages will be saved.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd pipeline

Manage and configure your deployment pipelines. (Beta)

Options

      --docs   Opens the documentation for azd pipeline in your web browser.
  -h, --help   Gets help for pipeline.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd pipeline config

Configure your deployment pipeline to connect securely to Azure. (Beta)

azd pipeline config [flags]

Options

  -m, --applicationServiceManagementReference string   Service Management Reference. References application or service contact information from a Service or Asset Management database. This value must be a Universally Unique Identifier (UUID). You can set this value globally by running azd config set pipeline.config.applicationServiceManagementReference <UUID>.
      --auth-type string                               The authentication type used between the pipeline provider and Azure for deployment (Only valid for GitHub provider). Valid values: federated, client-credentials.
      --docs                                           Opens the documentation for azd pipeline config in your web browser.
  -e, --environment string                             The name of the environment to use.
  -h, --help                                           Gets help for config.
      --principal-id string                            The client id of the service principal to use to grant access to Azure resources as part of the pipeline.
      --principal-name string                          The name of the service principal to use to grant access to Azure resources as part of the pipeline.
      --principal-role stringArray                     The roles to assign to the service principal. By default the service principal will be granted the Contributor and User Access Administrator roles. (default [Contributor,User Access Administrator])
      --provider string                                The pipeline provider to use (github for Github Actions and azdo for Azure Pipelines).
      --remote-name string                             The name of the git remote to configure the pipeline to run on. (default "origin")

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd provision

Provision the Azure resources for an application.

azd provision [flags]

Options

      --docs                 Opens the documentation for azd provision in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for provision.
      --no-state             Do not use latest Deployment State (bicep only).
      --preview              Preview changes to Azure resources.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd restore

Restores the application's dependencies. (Beta)

azd restore <service> [flags]

Options

      --all                  Restores all services that are listed in azure.yaml
      --docs                 Opens the documentation for azd restore in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for restore.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd show

Display information about your app and its resources.

azd show [flags]

Options

      --docs                 Opens the documentation for azd show in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for show.
      --show-secrets         Unmask secrets in output.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd template

Find and view template details. (Beta)

Options

      --docs   Opens the documentation for azd template in your web browser.
  -h, --help   Gets help for template.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd template list

Show list of sample azd templates. (Beta)

azd template list [flags]

Options

      --docs             Opens the documentation for azd template list in your web browser.
  -f, --filter strings   The tag(s) used to filter template results. Supports comma-separated values.
  -h, --help             Gets help for list.
  -s, --source string    Filters templates by source.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd template show

Show details for a given template. (Beta)

azd template show <template> [flags]

Options

      --docs   Opens the documentation for azd template show in your web browser.
  -h, --help   Gets help for show.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd template source

View and manage template sources. (Beta)

Options

      --docs   Opens the documentation for azd template source in your web browser.
  -h, --help   Gets help for source.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd template source add

Adds an azd template source with the specified key. (Beta)

Synopsis

The key can be any value that uniquely identifies the template source, with well-known values being:
・default: Default templates
・awesome-azd: Templates from https://aka.ms/awesome-azd

azd template source add <key> [flags]

Options

      --docs              Opens the documentation for azd template source add in your web browser.
  -h, --help              Gets help for add.
  -l, --location string   Location of the template source. Required when using type flag.
  -n, --name string       Display name of the template source.
  -t, --type string       Kind of the template source. Supported types are 'file', 'url' and 'gh'.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd template source list

Lists the configured azd template sources. (Beta)

azd template source list [flags]

Options

      --docs   Opens the documentation for azd template source list in your web browser.
  -h, --help   Gets help for list.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd template source remove

Removes the specified azd template source (Beta)

azd template source remove <key> [flags]

Options

      --docs   Opens the documentation for azd template source remove in your web browser.
  -h, --help   Gets help for remove.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd up

Provision Azure resources, and deploy your project with a single command.

azd up [flags]

Options

      --docs                 Opens the documentation for azd up in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for up.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd version

Print the version number of Azure Developer CLI.

azd version [flags]

Options

      --docs   Opens the documentation for azd version in your web browser.
  -h, --help   Gets help for version.

Options inherited from parent commands

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

See also

@saragluna
Copy link
Member Author

@JeffreyCA the issue has been fixed in azure-javaee#104

@JeffreyCA
Copy link
Contributor

@JeffreyCA the issue has been fixed in azure-javaee#104

Thank you, it seems to be working now. I tried to deploy a few of the samples from https://github.com/azure-javaee/azure-spring-boot-samples with the latest build but the two I tested both weren't working. They definitely used to work though.

  1. kafka-sample - azd up succeeds, but errors in the container app logs:
2025-01-13T19:04:37.087306800Z 2025-01-13T19:04:37.086Z  WARN 8 --- [   scheduling-1] org.apache.kafka.clients.ClientUtils     : Couldn't resolve server <Kafka_Namespace>.servicebus.windows.net:9093 from bootstrap.servers as DNS resolution failed for .servicebus.windows.net
2025-01-13T19:04:37.087313723Z 2025-01-13T19:04:37.086Z ERROR 8 --- [   scheduling-1] o.s.cloud.stream.binding.BindingService  : Failed to create consumer binding; retrying in 30 seconds
2025-01-13T19:04:37.087389555Z 
2025-01-13T19:04:37.087401377Z org.springframework.cloud.stream.binder.BinderException: Exception thrown while starting consumer: 
2025-01-13T19:04:37.087409291Z  at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindConsumer(AbstractMessageChannelBinder.java:594) ~[spring-cloud-stream-4.1.3.jar!/:4.1.3]
2025-01-13T19:04:37.087416284Z  at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindConsumer(AbstractMessageChannelBinder.java:103) ~[spring-cloud-stream-4.1.3.jar!/:4.1.3]
2025-01-13T19:04:37.087454235Z  at org.springframework.cloud.stream.binder.AbstractBinder.bindConsumer(AbstractBinder.java:144) ~[spring-cloud-stream-4.1.3.jar!/:4.1.3]
2025-01-13T19:04:37.087461930Z  at org.springframework.cloud.stream.binding.BindingService.lambda$rescheduleConsumerBinding$1(BindingService.java:211) ~[spring-cloud-stream-4.1.3.jar!/:4.1.3]
2025-01-13T19:04:37.087468752Z  at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-6.1.14.jar!/:6.1.14]
2025-01-13T19:04:37.087478751Z  at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[na:na]
2025-01-13T19:04:37.087485694Z  at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[na:na]
2025-01-13T19:04:37.087492236Z  at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na]
2025-01-13T19:04:37.087498788Z  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[na:na]
2025-01-13T19:04:37.087505241Z  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[na:na]
2025-01-13T19:04:37.087511883Z  at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]
2025-01-13T19:04:37.087518425Z Caused by: org.apache.kafka.common.KafkaException: Failed to create new KafkaAdminClient
2025-01-13T19:04:37.087525028Z  at org.apache.kafka.clients.admin.KafkaAdminClient.createInternal(KafkaAdminClient.java:541) ~[kafka-clients-3.7.1.jar!/:na]
2025-01-13T19:04:37.087531480Z  at org.apache.kafka.clients.admin.Admin.create(Admin.java:147) ~[kafka-clients-3.7.1.jar!/:na]
2025-01-13T19:04:37.087538082Z  at org.apache.kafka.clients.admin.AdminClient.create(AdminClient.java:49) ~[kafka-clients-3.7.1.jar!/:na]
2025-01-13T19:04:37.087544885Z  at org.springframework.cloud.stream.binder.kafka.provisioning.KafkaTopicProvisioner.createAdminClient(KafkaTopicProvisioner.java:290) ~[spring-cloud-stream-binder-kafka-core-4.1.3.jar!/:4.1.3]
...
  1. spring-cloud-azure-mysql-sample - azd up succeeds, but errors in the container app logs:
    2025-01-13T18:22:34.952268852Z The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    2025-01-13T18:22:34.952283018Z 	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[na:na]
    2025-01-13T18:22:34.952289921Z 	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[na:na]
    2025-01-13T18:22:34.952297465Z 	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[na:na]
    2025-01-13T18:22:34.952312774Z 	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-j-8.3.0.jar!/:8.3.0]
    2025-01-13T18:22:34.952319717Z 	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:104) ~[mysql-connector-j-8.3.0.jar!/:8.3.0]
    2025-01-13T18:22:34.952326299Z 	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:149) ~[mysql-connector-j-8.3.0.jar!/:8.3.0]
    2025-01-13T18:22:34.952332741Z 	at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:165) ~[mysql-connector-j-8.3.0.jar!/:8.3.0]
    2025-01-13T18:22:34.952339173Z 	at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:88) ~[mysql-connector-j-8.3.0.jar!/:8.3.0]
    2025-01-13T18:22:34.952345695Z 	at com.mysql.cj.NativeSession.connect(NativeSession.java:120) ~[mysql-connector-j-8.3.0.jar!/:8.3.0]
    2025-01-13T18:22:34.952352127Z 	at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:935) ~[mysql-connector-j-8.3.0.jar!/:8.3.0]
    2025-01-13T18:22:34.952358489Z 	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:805) ~[mysql-connector-j-8.3.0.jar!/:8.3.0]
    2025-01-13T18:22:34.952364851Z 	... 121 common frames omitted
    2025-01-13T18:22:34.952371403Z Caused by: java.net.UnknownHostException: ${AZ_DATABASE_SERVER_NAME}.mysql.database.azure.com: Name or service not known
    2025-01-13T18:22:34.952377805Z 	at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[na:na]
    2025-01-13T18:22:34.952384457Z 	at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:52) ~[na:na]
    2025-01-13T18:22:34.952390939Z 	at java.base/java.net.InetAddress$PlatformResolver.lookupByName(InetAddress.java:1211) ~[na:na]
    2025-01-13T18:22:34.952397331Z 	at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1828) ~[na:na]
    2025-01-13T18:22:34.952405496Z 	at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:1139) ~[na:na]
    2025-01-13T18:22:34.952413692Z 	at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1818) ~[na:na]
    2025-01-13T18:22:34.952420344Z 	at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1688) ~[na:na]
    2025-01-13T18:22:34.952427106Z 	at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:130) ~[mysql-connector-j-8.3.0.jar!/:8.3.0]
    2025-01-13T18:22:34.952433929Z 	at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:62) ~[mysql-connector-j-8.3.0.jar!/:8.3.0]
    2025-01-13T18:22:34.952441603Z 	... 124 common frames omitted
    2025-01-13T18:22:34.952448236Z 

In both cases it looks like some of the placeholder values aren't being substituted correctly? E.g. <Kafka_Namespace>.servicebus.windows.net:9093 and ${AZ_DATABASE_SERVER_NAME}.mysql.database.azure.com

// 2. pom.Build.Plugins.
// 2.1. Only care about the groupId/artifactId/version.
// 2.2. Not include the default maven plugins (name with this patten: "maven-xxx-plugin").
func createSimulatedEffectivePom(pomFilePath string) (pom, error) {
Copy link
Contributor

@weikanglim weikanglim Jan 13, 2025

Choose a reason for hiding this comment

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

I'm of the opinion that createSimulatedEffectivePom is not a good idea in the long run. Should we keep this simple here, and just rely on mvn effective:pom, erroring out if maven isn't installed or errors out?

There is enough meat here to be a separate OSS library that effectively simulates POM. As a standalone project, or one that is close to such, the library needs to be documented how effective it is doing it, and how it differs in evaluation from mvn. The current implementation doesn't make it easy for anyone to see how this differs from a maven evaluation which is a source of unreliability.

I would imagine that we don't want downstream code to get the wrong information here because we ended up evaluating maven differently than normal.

Copy link
Member

Choose a reason for hiding this comment

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

Here is the flow of using azd to deploy existing Spring Boot project:

  1. Step 1: Use azd init to create azure.yaml by analyzing Spring Boot project.
  2. Step 2: Check the content of azure.yaml, update azure.yaml if necessary.
  3. Step 3: Use azd up to deploy the project.

When mvn not exist in curtomer's Path, azd has 2 options:

  1. Exit azd, and let customer intall mvn.
  2. Try best to get the information of current project, even it's possible to have some mistake in some corner cases, then continue the Step 2 in above step.

As a Java developer, I prefer option 2.

@weikanglim , @saragluna , which one do you prefer?

"maven could not be found. Install either Maven or Maven Wrapper by " +
"visiting https://maven.apache.org/ or https://maven.apache.org/wrapper/",
)
return getDownloadedMvnCommand(downloadedMavenVersion)
Copy link
Contributor

Choose a reason for hiding this comment

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

We want to avoid auto-acquiring build tools for users here. If a Java developer working on a maven project doesn't have maven installed, it isn't right for us to "fill the gap" by auto-acquiring maven for them.

This isn't something I'd expect an azure tool like azd to be doing; and I certainly don't think this is something our users would expect either.

Copy link
Member

Choose a reason for hiding this comment

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

Hi, @weikanglim

Thanks for the feedback. But I feel it isn't a problem to download maven in azd:

  1. From customer's perspective: the azd downloaded maven won't affect customer's Path. Customer's won't know the azd downloaded maven unless customer opened this folder: ~/.azd/java.
  2. From azd developer's perspective: download maven and use it to get effective pom, it's the implementation detail of azd. IMU, it's not rare that one tool download another tool.
  3. Current azd already has code to download other command line tools, for example: bicep command line tool. Here is the screenshot of related code:

image

Copy link
Contributor

@weikanglim weikanglim Jan 14, 2025

Choose a reason for hiding this comment

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

Hi @rujche, thanks for the reply.

From customer's perspective: the azd downloaded maven won't affect customer's Path

That is true, and I do recognize that. However, it's also possible that the maven downloaded could be incompatible with the maven project set up, resulting in a different expected result. Supposedly, if the maven version downloaded has a subtly difference in behavior due to version differences, this creates a very hard to troubleshoot scenario.

In the new change, we effectively also change the mvn that azd package uses to package a user's application. Imagine if the user had changed their PATH settings, that doesn't include mvn. User runs azd package, which subtly uses a different maven version to package their production application. This ended up breaking the application, but only at runtime, which creates this extremely difficult to troubleshoot issue.

From azd developer's perspective: download maven and use it to get effective pom, it's the implementation detail of azd.

In general, we want to limit our footprint of tools we download both from a security and maintenance perspective. Currently we have pack, gh and bicep as the tools we auto-acquire. There are good reasons behind each tool invocation, as we don't think the developers should need to install these tools. Here, we are discussing a scenario where a Java developer is working on a maven project without maven installed, which in my mind, is not a very valid scenario.

Sometimes doing the right thing for the customer is to not do more than we need to. Having Java developers install the tools that they want to use for the language they work on is perfectly fine in mind.

Copy link
Member

Choose a reason for hiding this comment

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

Hi, @weikanglim

Sorry for my late response.

Supposedly, if the maven version downloaded has a subtly difference in behavior due to version differences, this creates a very hard to troubleshoot scenario.

In this case, customer should provide a maven wrapper. Wen maven wrapper is included in the repo, the downloaded maven will not be used. If customer didn't provide a maven wrapper, we (azd) will never get required information to deploy the app.

In the new change, we effectively also change the mvn that azd package uses to package a user's application.

If we consider this case, build from source will have this problem, too. build from source can not be used. we will never get the right docker image to deploy a maven project.

Having Java developers install the tools that they want to use for the language they work on is perfectly fine in mind.

Do you mean make related azd sub command failed when mvn is not installed in his environment?

@@ -704,7 +710,7 @@ module redisConn './modules/set-redis-conn.bicep' = {
}
{{- end}}

{{- if .Services}}
{{- if (or .Services .DbCosmosMongo .DbRedis)}}
Copy link
Contributor

Choose a reason for hiding this comment

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

This actually ends up fixing #4574 and is an idea I had in mind as well. Any thoughts on this approach @weikanglim?

Copy link
Contributor

Choose a reason for hiding this comment

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

@JeffreyCA Thanks for tagging me on this! At a first glance, I'd probably recommend not exporting the KeyVault secret if there are no services to bind to.

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense too. I created a separate PR to address this here: #4692

Copy link
Contributor

Choose a reason for hiding this comment

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

I've merged the changes, so @saragluna you may need to revert this and pull the changes from main

@@ -20,6 +20,8 @@ type ServiceConfig struct {
ResourceName osutil.ExpandableString `yaml:"resourceName,omitempty"`
// The ARM api version to use for the service. If not specified, the latest version is used.
ApiVersion string `yaml:"apiVersion,omitempty"`
// The path to the parent directory of the project
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's try to use the docker.context property to set the build context

Comment on lines +205 to +219
// if it's a java project without Dockerfile, we help to package jar and add a default Dockerfile for Docker build
if serviceConfig.Language == ServiceLanguageJava && serviceConfig.Docker.Path == "" {
mvnCli := maven.NewCli(exec.NewCommandRunner(nil))
err := mvnCli.CleanPackage(ctx, serviceConfig.RelativePath, serviceConfig.Project.Path)
if err != nil {
return nil, err
}
defaultDockerfilePath, err := addDefaultDockerfileForJavaProject(serviceConfig.Name)
if err != nil {
return nil, err
}
serviceConfig.Docker = DockerProjectOptions{
Path: defaultDockerfilePath,
}
}
Copy link
Contributor

@weikanglim weikanglim Jan 14, 2025

Choose a reason for hiding this comment

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

I think you're running into microsoft/Oryx#2562 here.

In the meantime, I think we can consider testing out Paketo's Buildpack implementation. We can change the build on line 466 to point to paketobuildpacks/builder-jammy-base (only for Java) and see how well this works.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will test it.

@saragluna
Copy link
Member Author

@JeffreyCA azure-javaee#106 fixes the issue. This will revert a previous PR.

@azure-sdk
Copy link
Collaborator

VSCode Extension Installation Instructions

  1. Download the extension at https://azuresdkreleasepreview.blob.core.windows.net/azd/vscode/pr/4473/azure-dev-0.9.0-alpha.1.vsix
  2. Extract the extension from the compressed file
  3. In vscode
    a. Open "Extensions" (Ctrl+Shift+X)
    b. Click the ...\ menu at top of Extensions sidebar
    c. Click "Install from VSIX"
    d. Select location of downloaded file

haoozhang and others added 2 commits January 20, 2025 15:53
* add uts for app_init, detect_confirm, infra_confirm, and scaffold
@@ -251,7 +307,7 @@ func (i *Initializer) InitFromApp(
var infraSpec *scaffold.InfraSpec
composeEnabled := i.features.IsEnabled(featureCompose)
if !composeEnabled { // backwards compatibility
spec, err := i.infraSpecFromDetect(ctx, detect)
spec, err := i.infraSpecFromDetect(ctx, &detect)
Copy link
Member

Choose a reason for hiding this comment

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

Hi, @weikanglim .

  1. Can we delete spec.go, and use project_config.go to generage bicep files directly? IMU, all information required to generated bicep files are contained in ProjectConfig in project_config.go
  2. Can we delete infraSpecFromDetect, and always use ProjectConfig to generage bicep files? Delete the line in this diagram:

image

After deleted above one line and one node, the whole process will be much easier to understand:

image

@@ -67,4 +67,10 @@ output AZURE_RESOURCE_REDIS_ID string = resources.outputs.AZURE_RESOURCE_REDIS_I
{{- if .DbPostgres}}
output AZURE_RESOURCE_{{alphaSnakeUpper .DbPostgres.DatabaseName}}_ID string = resources.outputs.AZURE_RESOURCE_{{alphaSnakeUpper .DbPostgres.DatabaseName}}_ID
{{- end}}
{{- if .DbMySql}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these start with AZURE_RESOURCE_, instead of AZURE_ like above?

@@ -465,4 +773,13 @@ output AZURE_RESOURCE_REDIS_ID string = redis.outputs.resourceId
{{- if .DbPostgres}}
output AZURE_RESOURCE_{{alphaSnakeUpper .DbPostgres.DatabaseName}}_ID string = '${postgreServer.outputs.resourceId}/databases/{{.DbPostgres.DatabaseName}}'
{{- end}}
{{- if .DbMySql}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Likewise, should these also start with AZURE_RESOURCE_? How are these outputs used?

Copy link

Pull request contains merge conflicts.

@JeffreyCA
Copy link
Contributor

/azp run

Copy link

Pull request contains merge conflicts.

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.

6 participants