{"action":"opened","issue":{"url":"https://api.github.com/repos/Azure/azure-cli/issues/7258","repository_url":"https://api.github.com/repos/Azure/azure-cli","labels_url":"https://api.github.com/repos/Azure/azure-cli/issues/7258/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-cli/issues/7258/comments","events_url":"https://api.github.com/repos/Azure/azure-cli/issues/7258/events","html_url":"https://github.com/Azure/azure-cli/issues/7258","id":358320910,"node_id":"MDU6SXNzdWUzNTgzMjA5MTA=","number":7258,"title":"`az login --service-principal` results in UnboundLocalError","user":{"login":"RikkiGibson","id":5833655,"node_id":"MDQ6VXNlcjU4MzM2NTU=","avatar_url":"https://avatars2.githubusercontent.com/u/5833655?v=4","gravatar_id":"","url":"https://api.github.com/users/RikkiGibson","html_url":"https://github.com/RikkiGibson","followers_url":"https://api.github.com/users/RikkiGibson/followers","following_url":"https://api.github.com/users/RikkiGibson/following{/other_user}","gists_url":"https://api.github.com/users/RikkiGibson/gists{/gist_id}","starred_url":"https://api.github.com/users/RikkiGibson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RikkiGibson/subscriptions","organizations_url":"https://api.github.com/users/RikkiGibson/orgs","repos_url":"https://api.github.com/users/RikkiGibson/repos","events_url":"https://api.github.com/users/RikkiGibson/events{/privacy}","received_events_url":"https://api.github.com/users/RikkiGibson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-08T19:15:40Z","updated_at":"2018-09-08T19:15:40Z","closed_at":null,"author_association":"MEMBER","body":"**Describe the bug**\r\nRunning `az login --service-principal` with no other arguments results in a runtime error.\r\n\r\n**To Reproduce**\r\n1. run `az login --service-principal`\r\n2. login in the browser window opened by CLI\r\n\r\nResults in\r\n\r\n```sh\r\nNote, we have launched a browser for you to login. For old experience with device code, use \"az login --use-device-code\"\r\nYou have logged in. Now let us find all the subscriptions to which you have access...\r\nlocal variable 'sp_auth' referenced before assignment\r\nTraceback (most recent call last):\r\n  File \"/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/knack/cli.py\", line 197, in invoke\r\n    cmd_result = self.invocation.execute(args)\r\n  File \"/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py\", line 369, in execute\r\n    six.reraise(*sys.exc_info())\r\n  File \"/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/six.py\", line 693, in reraise\r\n    raise value\r\n  File \"/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py\", line 343, in execute\r\n    result = cmd(params)\r\n  File \"/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py\", line 182, in __call__\r\n    return self.handler(*args, **kwargs)\r\n  File \"/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/azure/cli/core/__init__.py\", line 436, in default_command_handler\r\n    result = op(**command_args)\r\n  File \"/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/azure/cli/command_modules/profile/custom.py\", line 128, in login\r\n    allow_no_subscriptions=allow_no_subscriptions)\r\n  File \"/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/azure/cli/core/_profile.py\", line 209, in find_subscriptions_on_login\r\n    self._creds_cache.save_service_principal_cred(sp_auth.get_entry_to_persist(username,\r\nUnboundLocalError: local variable 'sp_auth' referenced before assignment\r\n```\r\n**Expected behavior**\r\nShould have either succeeded or provided a friendly message about the missing parameters\r\n\r\n**Environment summary**\r\nInstall Method: homebrew\r\nCLI version: 2.0.45\r\nOS version: macOS 10.13.6\r\nShell Type: bash\r\n\r\n"}}
{"actor":{"display_login":"RikkiGibson"}}