Skip to content

Commit

Permalink
[Containerapp] az containerapp auth update: Fix AuthConfigSecretRef…
Browse files Browse the repository at this point in the history
…NotFound (Azure#7679)
  • Loading branch information
Greedygre authored Jun 4, 2024
1 parent b103c65 commit 1db5235
Show file tree
Hide file tree
Showing 4 changed files with 1,509 additions and 941 deletions.
1 change: 1 addition & 0 deletions src/containerapp/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ upcoming
* 'az containerapp job logs show': Support log streaming for job execution
* 'az containerapp job replica list': Support list replicas of a job execution
* 'az containerapp env update': Fix logs configuration about removing destination with `--logs-destination none`
* 'az containerapp auth update': Fix AuthConfigSecretRefNotFound when setting secret

0.3.52
++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ def set_up_token_store(self):
raise ArgumentUsageError('Usage Error: only blob storage token store is supported. --sas-url-secret and --sas-url-secret-name should provide exactly one when token store is enabled')
if self.get_argument_sas_url_secret() is not None and self.get_argument_sas_url_secret_name() is not None:
raise ArgumentUsageError('Usage Error: --sas-url-secret and --sas-url-secret-name cannot both be set')
if self.get_argument_sas_url_secret() is not None and not self.get_argument_yes():
msg = 'Configuring --sas-url-secret will add a secret to the containerapp. Are you sure you want to continue?'
if not prompt_y_n(msg, default="n"):
raise ArgumentUsageError('Usage Error: --sas-url-secret cannot be used without agreeing to add secret to the containerapp.')

sas_url_setting_name = BLOB_STORAGE_TOKEN_STORE_SECRET_SETTING_NAME
if self.get_argument_sas_url_secret_name() is not None:
Expand Down
11 changes: 8 additions & 3 deletions src/containerapp/azext_containerapp/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

from azure.cli.core.azclierror import (
RequiredArgumentMissingError,
ResourceNotFoundError,
ValidationError,
CLIError,
CLIInternalError,
InvalidArgumentValueError,
ResourceNotFoundError)
ResourceNotFoundError,
ArgumentUsageError)
from azure.cli.core.commands.client_factory import get_subscription_id
from azure.cli.command_modules.containerapp.custom import set_secrets, open_containerapp_in_browser, create_deserializer
from azure.cli.command_modules.containerapp.containerapp_job_decorator import ContainerAppJobDecorator
Expand Down Expand Up @@ -1356,7 +1356,12 @@ def update_auth_config(cmd, resource_group_name, name, set_string=None, enabled=

containerapp_auth_decorator.construct_payload()
if containerapp_auth_decorator.get_argument_token_store() and containerapp_auth_decorator.get_argument_sas_url_secret() is not None:
set_secrets(cmd, name, resource_group_name, secrets=[f"{BLOB_STORAGE_TOKEN_STORE_SECRET_SETTING_NAME}={containerapp_auth_decorator.get_argument_sas_url_secret()}"], no_wait=True, disable_max_length=True)
if not containerapp_auth_decorator.get_argument_yes():
msg = 'Configuring --sas-url-secret will add a secret to the containerapp. Are you sure you want to continue?'
if not prompt_y_n(msg, default="n"):
raise ArgumentUsageError(
'Usage Error: --sas-url-secret cannot be used without agreeing to add secret to the containerapp.')
set_secrets(cmd, name, resource_group_name, secrets=[f"{BLOB_STORAGE_TOKEN_STORE_SECRET_SETTING_NAME}={containerapp_auth_decorator.get_argument_sas_url_secret()}"], no_wait=False, disable_max_length=True)
return containerapp_auth_decorator.create_or_update()


Expand Down
Loading

0 comments on commit 1db5235

Please sign in to comment.