Skip to content
Merged
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
9 changes: 8 additions & 1 deletion src/azure-cli/azure/cli/command_modules/vm/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3273,7 +3273,14 @@ def create_image_version(cmd, resource_group_name, gallery_name, gallery_image_n
cred, _, _ = profile.get_login_credentials(resource=resource,
aux_subscriptions=aux_subscriptions)
_, _, _, external_tokens = cred.get_all_tokens('https://management.azure.com/.default')
external_bearer_token = external_tokens[0][0] + ' ' + external_tokens[0][1]
if external_tokens:
external_token = external_tokens[0]
if len(external_token) >= 2:
external_bearer_token = external_token[0] + ' ' + external_token[1]
else:
logger.warning('Getting external tokens failed.')
else:
logger.warning('Getting external tokens failed.')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a warning or error? It will cause command failed at later right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally, it will fail in service side if service requires external tokens.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logger.warning() goes to the stderr and breaks our Azure DevOps pipeline, which now thinks that AzureCLI task printed some error. The command itself (az sig image-version create) works fine as it did before, returns JSON result with "provisioningState": "Succeeded".


location = location or _get_resource_group_location(cmd.cli_ctx, resource_group_name)
end_of_life_date = fix_gallery_image_date_info(end_of_life_date)
Expand Down