-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
Accountaz login/accountaz login/accountAuto-AssignAuto assign by botAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone
Description
ADO's Azure CLI task contains this step:
Setting AZURE_CONFIG_DIR env variable to: /mnt/vss/_work/_temp/.azclitask
In Knack, the config dir specified by env var takes higher precedence:
self.config_dir = os.environ.get('{}CONFIG_DIR'.format(env_var_prefix), default_config_dir)So when AZURE_CONFIG_DIR is set, setting config_dir becomes a no-op for AzCli:
azure-cli/src/azure-cli-core/azure/cli/core/mock.py
Lines 44 to 46 in c087891
| super(DummyCli, self).__init__( | |
| cli_name='az', | |
| config_dir=config_dir, |
self.config.config_dir in this case is the value of AZURE_CONFIG_DIR (/mnt/vss/_work/_temp/.azclitask).
During tearDown, directory specified by AZURE_CONFIG_DIR gets deleted:
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py
Lines 139 to 144 in b223dd9
| def tearDown(self): | |
| for processor in self._processors_to_reset: | |
| processor.reset() | |
| if self.random_config_dir: | |
| from azure.cli.core.util import rmtree_with_retry | |
| rmtree_with_retry(self.cli_ctx.config.config_dir) |
This causes failure in the following azdev test --live command:
self = <azure.cli.core._profile.Profile object at 0x7f3d731794b0>
subscription = None
def get_subscription(self, subscription=None): # take id or name
subscriptions = self.load_cached_subscriptions()
if not subscriptions:
> raise CLIError(_AZ_LOGIN_MESSAGE)
E knack.util.CLIError: Please run 'az login' to setup account.
src/azure-cli-core/azure/cli/core/_profile.py:546: CLIError
Introduced by #25689
Discovered while working on #28660
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Accountaz login/accountaz login/accountAuto-AssignAuto assign by botAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that