Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/containerapp/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Release History
Upcoming
++++++
* 'az containerapp create/update': --termination-grace-period support custom termination grace period
* 'az containerapp env logs show': fix issue of constructing connection url

0.3.34
++++++
Expand Down
16 changes: 10 additions & 6 deletions src/containerapp/azext_containerapp/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
check_managed_cert_name_availability, prepare_managed_certificate_envelop,
get_default_workload_profile_name_from_env, get_default_workload_profiles, ensure_workload_profile_supported, _generate_secret_volume_name,
parse_service_bindings, get_linker_client, check_unique_bindings,
get_current_mariner_tags, patchable_check, get_pack_exec_path, is_docker_running, trigger_workflow, AppType)
get_current_mariner_tags, patchable_check, get_pack_exec_path, is_docker_running, trigger_workflow, AppType,
format_location)
from ._validators import validate_create, validate_revision_suffix
from ._ssh_utils import (SSH_DEFAULT_ENCODING, WebSocketConnection, read_ssh, get_stdin_writer, SSH_CTRL_C_MSG,
SSH_BACKUP_ENCODING)
Expand Down Expand Up @@ -4354,13 +4355,16 @@ def stream_environment_logs(cmd, resource_group_name, name, follow=False, tail=N
raise ValidationError("--tail must be between 0 and 300.")

env = show_managed_environment(cmd, name, resource_group_name)
sub = get_subscription_id(cmd.cli_ctx)
url = safe_get(env, "properties", "eventStreamEndpoint")

if url is None:
sub = get_subscription_id(cmd.cli_ctx)
base_url = f"https://{format_location(env['location'])}.azurecontainerapps.dev"
url = (f"{base_url}/subscriptions/{sub}/resourceGroups/{resource_group_name}/managedEnvironments/{name}"
f"/eventstream")

token_response = ManagedEnvironmentClient.get_auth_token(cmd, resource_group_name, name)
token = token_response["properties"]["token"]
base_url = f"https://{env['location']}.azurecontainerapps.dev"

url = (f"{base_url}/subscriptions/{sub}/resourceGroups/{resource_group_name}/managedEnvironments/{name}"
f"/eventstream")

logger.info("connecting to : %s", url)
request_params = {"follow": str(follow).lower(),
Expand Down
Loading