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

az containerapp compose create command should have an option to use an existing Log Analytics workspace instead of creating a new one #28904

Closed
vienleidl opened this issue May 7, 2024 · 3 comments
Labels
Auto-Assign Auto assign by bot ContainerApp customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.

Comments

@vienleidl
Copy link

Related command
az containerapp compose create -g resource_group_name --environment environment_name--location southeastasia --compose-file-path "./docker-compose.yml" --registry-server acr.azurecr.io --registry-username username --registry-password password

Is your feature request related to a problem? Please describe.
Yes, a new Log Analytics workspace is created automatically after the command finishes.

Describe the solution you'd like
az containerapp compose create command should have an option to use an existing Log Analytics workspace.

Describe alternatives you've considered
After the Container App environment is deployed, go to Logging options and manually change to an existing workspace.
image

Additional context
image

@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot ContainerApp Service Attention This issue is responsible by Azure service team. labels May 7, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented May 7, 2024

Thank you for opening this issue, we will look into it.

@Greedygre
Copy link
Contributor

Hi @vienleidl

In the az containerapp compose create command, if the specified environment name does not exist in the resource group or the environment resource Id does not exist, it will auto create a new environment will a new log workspace.

If you want to create an environment with exiting log workspace, you can use this:

$logs_workspace_customer_id=$(az monitor log-analytics workspace show -g {resource-group-name} -n {your-log-workspace-name} --query "customerId")
$logs_workspace_shared_key=$(az monitor log-analytics workspace get-shared-keys -g {resource-group-name} -n {your-log-workspace-name} --query "primarySharedKey")
az containerapp env create -n {name} -g {resource-group-name} --logs-workspace-id {logs_workspace_customer_id} --logs-workspace-key {logs_workspace_shared_key}

@vienleidl
Copy link
Author

Hi @vienleidl

In the az containerapp compose create command, if the specified environment name does not exist in the resource group or the environment resource Id does not exist, it will auto create a new environment will a new log workspace.

If you want to create an environment with exiting log workspace, you can use this:

$logs_workspace_customer_id=$(az monitor log-analytics workspace show -g {resource-group-name} -n {your-log-workspace-name} --query "customerId")
$logs_workspace_shared_key=$(az monitor log-analytics workspace get-shared-keys -g {resource-group-name} -n {your-log-workspace-name} --query "primarySharedKey")
az containerapp env create -n {name} -g {resource-group-name} --logs-workspace-id {logs_workspace_customer_id} --logs-workspace-key {logs_workspace_shared_key}

Hi @Greedygre, gotcha & thank you! Now I can see that the LA workspace is sticked with the Container App Environment, it means the workspace should be created in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot ContainerApp customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

3 participants