Azure / azure-functions-devops-build

A python library for setting up and managing Azure DevOps builds for Azure Functions projects
MIT License
14 stars 24 forks source link

Origanization listing is incomplete #42

Open Hazhzeng opened 5 years ago

Hazhzeng commented 5 years ago

Reported by @JK87iab in https://github.com/Azure/azure-functions-python-worker/issues/449

This issue occurs when a MSA user joined an AAD created organization. The devops-pipeline command fails to return a list of proper organizations in this scenario. A proper fix is to join the listing in organization_manager and combine MSA & AAD organizations together.

freedev commented 3 years ago

Not clear how do you have resolved this issue. I'm experiencing the same identical problem while executing this line:

az functionapp devops-pipeline create --organization-name AAAA --project-name BBB --subscription "CCC"
Error finding organization. Please check that the organization exists by navigating to the Azure DevOps portal at dev.azure.com

Trying to run this command with the debug options I would share the following stacktrace:

urllib3.connectionpool : https://app.vssps.visualstudio.com:443 "GET /_apis/Commerce/Subscription?memberId=XXXXXXXX&includeMSAAccounts=True&queryOnlyOwnerAccounts=True&inlcudeDisabledAccounts=False&providerNamespaceId=VisualStudioOnline HTTP/1.1" 200 143
azure.cli.core.util.handle_exception is called with an exception:
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.15.0/libexec/lib/python3.8/site-packages/knack/cli.py", line 215, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/Cellar/azure-cli/2.15.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 654, in execute
    raise ex
  File "/usr/local/Cellar/azure-cli/2.15.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 717, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/local/Cellar/azure-cli/2.15.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 710, in _run_job
    six.reraise(*sys.exc_info())
  File "/usr/local/Cellar/azure-cli/2.15.0/libexec/lib/python3.8/site-packages/six.py", line 703, in reraise
    raise value
  File "/usr/local/Cellar/azure-cli/2.15.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 688, in _run_job
    result = cmd_copy(params)
  File "/usr/local/Cellar/azure-cli/2.15.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 325, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.15.0/libexec/lib/python3.8/site-packages/azure/cli/core/__init__.py", line 784, in default_command_handler
    return op(**command_args)
  File "/usr/local/Cellar/azure-cli/2.15.0/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/custom.py", line 3982, in create_devops_pipeline
    return azure_devops_build_interactive.interactive_azure_devops_build()
  File "/usr/local/Cellar/azure-cli/2.15.0/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/azure_devops_build_interactive.py", line 99, in interactive_azure_devops_build
    return self.azure_devops_flow()
  File "/usr/local/Cellar/azure-cli/2.15.0/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/azure_devops_build_interactive.py", line 107, in azure_devops_flow
    self.process_organization()
  File "/usr/local/Cellar/azure-cli/2.15.0/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/azure_devops_build_interactive.py", line 266, in process_organization
    self.cmd_selector.cmd_organization(self.organization_name)
  File "/usr/local/Cellar/azure-cli/2.15.0/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/azure_devops_build_interactive.py", line 909, in cmd_organization
    raise CLIError("Error finding organization. "
knack.util.CLIError: Error finding organization. Please check that the organization exists by navigating to the Azure DevOps portal at dev.azure.com

cli.azure.cli.core.azclierror : Error finding organization. Please check that the organization exists by navigating to the Azure DevOps portal at dev.azure.com
Error finding organization. Please check that the organization exists by navigating to the Azure DevOps portal at dev.azure.com
Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x10ac49ee0>]