azure-cli
azure-cli copied to clipboard
az containerapp compose create command should have an option to use an existing Log Analytics workspace instead of creating a new one
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.
Additional context
Thank you for opening this issue, we will look into it.
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 @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.