Skip to content
Closed
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 azure-cli.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="azure\cli\_argparse.py" />
<Compile Include="azure\cli\_debug.py" />
<Compile Include="azure\cli\_logging.py" />
<Compile Include="azure\cli\_profile.py" />
<Compile Include="azure\cli\_session.py">
Expand Down
11 changes: 11 additions & 0 deletions src/azure/cli/_debug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import os

def allow_debug_connection(client):
if should_allow_debug_connection():
client.config.connection.verify = False

def should_allow_debug_connection():
try:
return bool(os.environ['AllowDebug'])
except KeyError:
return False
4 changes: 3 additions & 1 deletion src/azure/cli/commands/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from .._profile import Profile
from .._util import TableOutput
from ..commands import command, description, option
import azure.cli._debug as _debug

CLIENT_ID = '04b07795-8ddb-461a-bbee-02f9e1bf7b46'

Expand All @@ -21,8 +22,9 @@ def login(args, unexpected):
import getpass
password = getpass.getpass(_('Password: '))

credentials = UserPassCredentials(username, password, client_id=CLIENT_ID)
credentials = UserPassCredentials(username, password, client_id=CLIENT_ID, verify=_debug.should_allow_debug_connection())
client = SubscriptionClient(SubscriptionClientConfiguration(credentials))
_debug.allow_debug_connection(client)
subscriptions = client.subscriptions.list()

if not subscriptions:
Expand Down
4 changes: 3 additions & 1 deletion src/azure/cli/commands/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .._util import TableOutput
from ..commands import command, description, option
from .._profile import Profile
import azure.cli._debug as _debug

@command('storage account list')
@description('List storage accounts')
Expand All @@ -16,8 +17,9 @@ def list_accounts(args, unexpected):
profile = Profile()
#credentials, subscription_id = profile.get_credentials()
smc = StorageManagementClient(StorageManagementClientConfiguration(
*profile.get_credentials(),
*profile.get_credentials()
))
_debug.allow_debug_connection(smc)

group = args.get('resource-group')
if group:
Expand Down