Azure / azure-devops-cli-extension

Azure DevOps Extension for Azure CLI
https://docs.microsoft.com/en-us/cli/azure/ext/azure-devops/?view=azure-cli-latest
MIT License
624 stars 241 forks source link

az devops security group membership add 404 #775

Closed mathieugravil closed 5 years ago

mathieugravil commented 5 years ago

This is autogenerated. Please review and update as needed.

Describe the bug

urllib3.connectionpool : https://tgits-code.vssps.visualstudio.com:443 "PUT /_apis/Graph/Memberships/aad.MjhhYzI0NDktOGUxMC03NjJhLTg5MzgtOTNlZDEzYTU5OWM1/e1bd3e0f-d8e3-4859-a127-9f55cdc3f124 HTTP/1.1" 404 15 msrest.exceptions : Page not found. Operation returned an invalid status code of 404. handling generic error cli.azure.cli.core.util : request failed: Page not found. Operation returned an invalid status code of 404. request failed: Page not found. Operation returned an invalid status code of 404.

Command Name az devops security group membership add Extension Name: azure-devops. Version: 0.12.0.

Errors:

request failed: Page not found.  Operation returned an invalid status code of 404.

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

Expected Behavior

add user on group

Environment Summary

Linux-4.15.0-1055-azure-x86_64-with-debian-stretch-sid
Python 3.6.5
Shell: bash

azure-cli 2.0.72

Extensions:
azure-devops 0.12.0
aks-preview 0.4.12

Additional Context

ishitam8 commented 5 years ago

Hi @mathieugravil ,

I suspect there is some mismatch in arguments you are passing. Your URL contains GUID, which shouldn't be the case.

Can you run the command in debug mode and share the logs ? [Add ' --debug' to your command]

mathieugravil commented 5 years ago

Hello @ishitam8

Please find log:

mathieu@Azure:~$ az devops security group membership add --group-id "[monproj]\Project Administrators" --member-id "myuser.toto@mycomp.com" --organization "https://dev.azure.com/myorg" --debug Command arguments: ['devops', 'security', 'group', 'membership', 'add', '--group-id', '[monproj]\Project Administrators', '--member-id', 'myuser.toto@mycomp.com', '--organization', 'https://dev.azure.com/myorg', '--debug'] Event: Cli.PreExecute [] Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7fa86f59dd08>, <function OutputProducer.on_global_arguments at 0x7fa86f0d7b70>, <function CLIQuery.on_global_argumentsat 0x7fa86f101bf8>] Event: CommandInvoker.OnPreCommandTableCreate [] Installed command modules ['acr', 'acs', 'advisor', 'ams', 'apim', 'appconfig', 'appservice', 'backup', 'batch', 'batchai', 'billing', 'botservice', 'cdn', 'cloud', 'cognitiveservices', 'configure', 'consumption', 'container', 'cosmosdb', 'deploymentmanager', 'dla', 'dls', 'dms', 'eventgrid', 'eventhubs', 'extension', 'feedback', 'find', 'hdinsight', 'interactive', 'iot', 'iotcentral', 'keyvault', 'kusto', 'lab', 'managedservices', 'maps', 'monitor', 'natgateway', 'netappfiles', 'network', 'policyinsights', 'privatedns', 'profile', 'rdbms', 'redis', 'relay', 'reservations', 'resource', 'role', 'search', 'security', 'servicebus', 'servicefabric', 'signalr', 'sql', 'sqlvm', 'storage', 'vm'] Loaded module 'acr' in 0.016 seconds. Loaded module 'acs' in 0.006 seconds. Loaded module 'advisor' in 0.001 seconds. Event: CommandLoader.OnLoadCommandTable [] Loaded module 'ams' in 0.005 seconds. Loaded module 'apim' in 0.002 seconds. Loaded module 'appconfig' in 0.002 seconds. Loaded module 'appservice' in 0.009 seconds. Loaded module 'backup' in 0.003 seconds. Event: CommandLoader.OnLoadCommandTable [] Loaded module 'batch' in 0.009 seconds. Loaded module 'batchai' in 0.003 seconds. Loaded module 'billing' in 0.001 seconds. Loaded module 'botservice' in 0.003 seconds. Event: CommandLoader.OnLoadCommandTable [] Loaded module 'cdn' in 0.002 seconds. Loaded module 'cloud' in 0.001 seconds. Loaded module 'cognitiveservices' in 0.002 seconds. Loaded module 'configure' in 0.001 seconds. Loaded module 'consumption' in 0.002 seconds. Loaded module 'container' in 0.002 seconds. Loaded module 'cosmosdb' in 0.007 seconds. Loaded module 'deploymentmanager' in 0.003 seconds. Loaded module 'dla' in 0.004 seconds. Loaded module 'dls' in 0.003 seconds. Loaded module 'dms' in 0.002 seconds. Loaded module 'eventgrid' in 0.002 seconds. Loaded module 'eventhubs' in 0.003 seconds. Loaded module 'extension' in 0.001 seconds. Loaded module 'feedback' in 0.001 seconds. Loaded module 'find' in 0.001 seconds. Loaded module 'hdinsight' in 0.002 seconds. Loaded module 'interactive' in 0.000 seconds. Loaded module 'iot' in 0.005 seconds. Loaded module 'iotcentral' in 0.001 seconds. Loaded module 'keyvault' in 0.005 seconds. Loaded module 'kusto' in 0.002 seconds. Loaded module 'lab' in 0.003 seconds. Loaded module 'managedservices' in 0.001 seconds. Loaded module 'maps' in 0.002 seconds. Loaded module 'monitor' in 0.005 seconds. Loaded module 'natgateway' in 0.001 seconds. Event: CommandLoader.OnLoadCommandTable [] Loaded module 'netappfiles' in 0.004 seconds. Loaded module 'network' in 0.029 seconds. Loaded module 'policyinsights' in 0.002 seconds. Loaded module 'privatedns' in 0.005 seconds. Loaded module 'profile' in 0.001 seconds. Loaded module 'rdbms' in 0.007 seconds. Loaded module 'redis' in 0.002 seconds. Loaded module 'relay' in 0.003 seconds. Loaded module 'reservations' in 0.002 seconds. Loaded module 'resource' in 0.007 seconds. Loaded module 'role' in 0.006 seconds. Loaded module 'search' in 0.001 seconds. Loaded module 'security' in 0.002 seconds. Loaded module 'servicebus' in 0.005 seconds. Loaded module 'servicefabric' in 0.002 seconds. Loaded module 'signalr' in 0.002 seconds. Loaded module 'sql' in 0.008 seconds. Loaded module 'sqlvm' in 0.002 seconds. Event: CommandLoader.OnLoadCommandTable [] Loaded module 'storage' in 0.032 seconds. Loaded module 'vm' in 0.015 seconds. Loaded all modules in 0.262 seconds. (note: there's always an overhead with the first module loaded) Extensions directory: '/home/mathieu/.azure/cliextensions' Found 2 extensions: ['azure-devops', 'aks-preview'] Extensions directory: '/home/mathieu/.azure/cliextensions' Extension compatibility result: is_compatible=True cli_core_version=2.0.72 min_required=2.0.49 max_required=None Extensions directory: '/home/mathieu/.azure/cliextensions' Loaded extension 'azure-devops' in 0.022 seconds. Extensions directory: '/home/mathieu/.azure/cliextensions' Extension compatibility result: is_compatible=True cli_core_version=2.0.72 min_required=2.0.49 max_required=None Event: CommandLoader.OnLoadCommandTable [] Extensions directory: '/home/mathieu/.azure/cliextensions' Loaded extension 'aks-preview' in 0.003 seconds. Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7fa86ee7ff28>] az_command_data_logger : command args: devops security group membership add --group-id {} --member-id {} --organization {} --debug metadata file logging enabled - writing logs to '/home/mathieu/.azure/commands'. Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7fa86ee21f28>] Event: CommandInvoker.OnPostArgumentLoad [] Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7fa86edd7950>, <function register_cache_arguments..add_cache_arguments at 0x7fa86edd7ae8>] Event: CommandInvoker.OnCommandTableLoaded [] Event: CommandInvoker.OnPreParseArgs [<function _documentdb_deprecate at 0x7fa86c9977b8>] Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7fa86f0d7bf8>, <function CLIQuery.handle_query_parameter at 0x7fa86f101c80>, <function register_ids_argument..parse_ids_arguments at 0x7fa86edd79d8>, <function handler at 0x7fa86c85e378>, <function DevCommandsLoader.post_parse_args at 0x7fa86c0480d0>] Extensions directory: '/home/mathieu/.azure/cliextensions' Extensions directory: '/home/mathieu/.azure/cliextensions' az_command_data_logger : extension name: azure-devops az_command_data_logger : extension version: 0.12.0 Getting credential: azdevops-cli:https://dev.azure.com/myorg Getting credential: azdevops-cli: default Current cloud config: AzureCloud trying to get token (temp) for tenant cc251925-4d3d-43c3-808e-774f6ff0366b and user mathieu.gravil@mycomp.com attempting to read file /tmp/accessTokens.json as utf-8-sig adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - Authority:Performing instance discovery: ... adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - Authority:Performing static instance discovery adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - Authority:Authority validated via static instance discovery adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - TokenRequest:Getting token from cache with refresh if necessary. adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - CacheDriver:finding with query keys: {'_clientId': '...', 'userId': '...'} adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - CacheDriver:Looking for potential cache entries: {'_clientId': '...', 'userId': '...'} adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - CacheDriver:Found 4 potential entries. adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - CacheDriver:No resource specific cache entries found. adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - CacheDriver:Found an MRRT token. adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - CacheDriver:Returning token from cache lookup, AccessTokenId: b'zmIGeIl7IclvlR+UKMWgiZgwfiPPmf3Dv9s8ictrMOs=', RefreshTokenId: b'vfR1cPTKcNMgoKh63s84QE7CG/hw7e/b+4UMFUz3dn4=' adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - CacheDriver:Acquiring new access token from MRRT token. adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - TokenRequest:called to refresh a token from the cache adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - TokenRequest:Getting a new token from a refresh token urllib3.connectionpool : Starting new HTTPS connection (1): login.microsoftonline.com:443 urllib3.connectionpool : https://login.microsoftonline.com:443 "POST /cc251925-4d3d-43c3-808e-774f6ff0366b/oauth2/token HTTP/1.1" 200 2971 adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - OAuth2Client:Get Token Server returned this correlation_id: 5a97202d-3789-439e-988a-bb6322a90677 adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - CacheDriver:Created new cache entry from refresh response. adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - CacheDriver:Adding entry AccessTokenId: b'+yjTD7oEAnAiZegxRrvLWnzJcih3OZ/WtFfaPO2x530=', RefreshTokenId: b'vcEXBKmuGKX+2GR/uhXLCY0XAsfe2JluHgsipjWiaig=' adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - CacheDriver:Updating 4 cached refresh tokens adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - CacheDriver:Remove many: 4 adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - CacheDriver:Add many: 4 adal-python : 5a97202d-3789-439e-988a-bb6322a90677 - CacheDriver:Returning token derived from mrrt refresh. instance recieved in validate_token_for_instance https://dev.azure.com/myorg instance processed in validate_token_for_instance https://dev.azure.com/myorg msrest.universal_http.requests : Configuring retry: max_retries=3, backoff_factor=0.8, max_backoff=90 msrest.universal_http.requests : Configuring retry: max_retries=3, backoff_factor=0.8, max_backoff=90 azext_devops.devops_sdk._file_cache : Loading cache file: /home/mathieu/.azure-devops/python-sdk/cache/resources.json azext_devops.devops_sdk._file_cache : attempting to read file /home/mathieu/.azure-devops/python-sdk/cache/resources.json as utf-8-sig azext_devops.devops_sdk.connection : File cache hit for resources on: https://dev.azure.com/myorg msrest.universal_http.requests : Configuring retry: max_retries=3, backoff_factor=0.8, max_backoff=90 azext_devops.devops_sdk._file_cache : Loading cache file: /home/mathieu/.azure-devops/python-sdk/cache/options.json azext_devops.devops_sdk._file_cache : attempting to read file /home/mathieu/.azure-devops/python-sdk/cache/options.json as utf-8-sig azext_devops.devops_sdk.client : File cache hit for options on: https://myorg.visualstudio.com azext_devops.devops_sdk.client : Route template: _apis/{resource}/{*projectId} azext_devops.devops_sdk.client : Api version '5.0' azext_devops.devops_sdk.client : GET https://myorg.visualstudio.com/_apis/projects?stateFilter=all&$top=1&$skip=0 azext_devops.devops_sdk.client : Request content: None msrest.universal_http : Configuring redirects: allow=True, max=30 msrest.universal_http : Configuring request: timeout=100, verify=True, cert=None msrest.universal_http : Configuring proxies: '' msrest.universal_http : Evaluate proxies against ENV settings: True urllib3.connectionpool : Starting new HTTPS connection (1): myorg.visualstudio.com:443 urllib3.connectionpool : https://myorg.visualstudio.com:443 "GET /_apis/projects?stateFilter=all&$top=1&$skip=0 HTTP/1.1" 200 400 azext_devops.devops_sdk.client : Response content: b'{"count":1,"value":[{"id":"d4dba8b5-d9be-46c0-b9fb-a17d4afac423","name":"SoapToRest","description":"Fast\'n Flex\n08/02/2018\nRIA = Marie-H\xc3\xa9l\xc3\xa8ne COLYN","url":"https://myorg.visualstudio.com/_apis/projects/d4dba8b5-d9be-46c0-b9fb-a17d4afac423","state":"wellFormed","revision":147,"visibility":"private","lastUpdateTime":"2018-02-08T14:36:59.093Z"}]}' msrest.universal_http.requests : Configuring retry: max_retries=3, backoff_factor=0.8, max_backoff=90 Current cloud config: AzureCloud Azure devops telemetry enabled. Logging telemetry to azure devops server. msrest.universal_http.requests : Configuring retry: max_retries=3, backoff_factor=0.8, max_backoff=90 azext_devops.devops_sdk.client : File cache hit for options on: https://dev.azure.com/myorg msrest.universal_http.requests : Configuring retry: max_retries=3, backoff_factor=0.8, max_backoff=90 azext_devops.devops_sdk.connection : File cache hit for resources on: https://dev.azure.com/myorg msrest.universal_http.requests : Configuring retry: max_retries=3, backoff_factor=0.8, max_backoff=90 azext_devops.devops_sdk.client : Route template: _apis/{area}/{resource} azext_devops.devops_sdk.client : Api version '5.0-preview.1' azext_devops.devops_sdk.client : POST https://dev.azure.com/myorg/_apis/CustomerIntelligence/Events azext_devops.devops_sdk.client : Request content: [{'area': 'AzureDevopsCli', 'feature': 'devops', 'properties': {'Command': 'security group membership add', 'Args': 'member_id group_id organization', 'ShellType': None, 'IsInteractive': 'True', 'OutputType': 'json', 'OrgPresentInCommand': True, 'ProjectPresentInCommand': False, 'RepoPresentInCommand': False}}] msrest.universal_http : Configuring redirects: allow=True, max=30 msrest.universal_http : Configuring request: timeout=100, verify=True, cert=None msrest.universal_http : Configuring proxies: '' msrest.universal_http : Evaluate proxies against ENV settings: True urllib3.connectionpool : Starting new HTTPS connection (1): dev.azure.com:443 msrest.universal_http.requests : Configuring retry: max_retries=3, backoff_factor=0.8, max_backoff=90 azext_devops.devops_sdk.client : File cache hit for options on: https://myorg.vssps.visualstudio.com azext_devops.devops_sdk.client : Route template: _apis/{resource}/{identityId} azext_devops.devops_sdk.client : Api version '5.0' azext_devops.devops_sdk.client : GET https://myorg.vssps.visualstudio.com/_apis/Identities?searchFilter=General&filterValue=myuser.toto%40mycomp.com azext_devops.devops_sdk.client : Request content: None msrest.universal_http : Configuring redirects: allow=True, max=30 msrest.universal_http : Configuring request: timeout=100, verify=True, cert=None msrest.universal_http : Configuring proxies: '' msrest.universal_http : Evaluate proxies against ENV settings: True urllib3.connectionpool : Starting new HTTPS connection (1): myorg.vssps.visualstudio.com:443 urllib3.connectionpool : https://dev.azure.com:443 "POST /myorg/_apis/CustomerIntelligence/Events HTTP/1.1" 204 0 urllib3.connectionpool : https://myorg.vssps.visualstudio.com:443 "GET /_apis/Identities?searchFilter=General&filterValue=myuser.toto%40mycomp.com HTTP/1.1" 200 737 azext_devops.devops_sdk.client : Response content: b'{"count":1,"value":[{"id":"28ac2449-8e10-662a-8938-93ed13a599c5","descriptor":"Microsoft.IdentityModel.Claims.ClaimsIdentity;cc251925-4d3d-43c3-808e-774f6ff0366b\\myuser.toto@mycomp.com","subjectDescriptor":"aad.MjhhYzI0NDktOGUxMC03NjJhLTg5MzgtOTNlZDEzYTU5OWM1","providerDisplayName":"Alexandre BOISSY","isActive":true,"members":[],"memberOf":[],"memberIds":[],"properties":{"SchemaClassName":{"$type":"System.String","$value":"User"},"Description":{"$type":"System.String","$value":""},"Domain":{"$type":"System.String","$value":"cc251925-4d3d-43c3-808e-774f6ff0366b"},"Account":{"$type":"System.String","$value":"myuser.toto@mycomp.com"},"DN":{"$type":"System.String","$value":""},"Mail":{"$type":"System.String","$value":"myuser.toto@mycomp.com"},"SpecialType":{"$type":"System.String","$value":"Generic"},"PUID":{"$type":"System.String","$value":"aad:"},"ComplianceValidated":{"$type":"System.DateTime","$value":"2019-09-03T00:00:00Z"},"http://schemas.microsoft.com/identity/claims/objectidentifier":{"$type":"System.String","$value":"fff9a9ae-c270-494b-980a-15b588bedca5"},"DirectoryAlias":{"$type":"System.String","$value":"myuser.toto_mycomp.com#EXT#"}},"resourceVersion":2,"metaTypeId":255}]}' azext_devops.devops_sdk.client : Route template: _apis/{area}/{resource}/{storageKey} azext_devops.devops_sdk.client : Api version '5.0-preview.1' azext_devops.devops_sdk.client : GET https://myorg.vssps.visualstudio.com/_apis/Graph/Descriptors/28ac2449-8e10-662a-8938-93ed13a599c5 azext_devops.devops_sdk.client : Request content: None msrest.universal_http : Configuring redirects: allow=True, max=30 msrest.universal_http : Configuring request: timeout=100, verify=True, cert=None msrest.universal_http : Configuring proxies: '' msrest.universal_http : Evaluate proxies against ENV settings: True urllib3.connectionpool : Starting new HTTPS connection (1): myorg.vssps.visualstudio.com:443 urllib3.connectionpool : https://myorg.vssps.visualstudio.com:443 "GET /_apis/Graph/Descriptors/28ac2449-8e10-662a-8938-93ed13a599c5 HTTP/1.1" 200 352 azext_devops.devops_sdk.client : Response content: b'{"value":"aad.MjhhYzI0NDktOGUxMC03NjJhLTg5MzgtOTNlZDEzYTU5OWM1","_links":{"self":{"href":"https://myorg.vssps.visualstudio.com/_apis/Graph/Descriptors/28ac2449-8e10-662a-8938-93ed13a599c5"},"storageKey":{"href":"https://myorg.vssps.visualstudio.com/_apis/Graph/StorageKeys/aad.MjhhYzI0NDktOGUxMC03NjJhLTg5MzgtOTNlZDEzYTU5OWM1"},"subject":{"href":"https://myorg.vssps.visualstudio.com/_apis/Graph/Users/aad.MjhhYzI0NDktOGUxMC03NjJhLTg5MzgtOTNlZDEzYTU5OWM1"}}}' azext_devops.devops_sdk.client : Route template: _apis/{area}/{resource}/{subjectDescriptor}/{containerDescriptor} azext_devops.devops_sdk.client : Api version '5.0-preview.1' azext_devops.devops_sdk.client : PUT https://myorg.vssps.visualstudio.com/_apis/Graph/Memberships/aad.MjhhYzI0NDktOGUxMC03NjJhLTg5MzgtOTNlZDEzYTU5OWM1/%5Bmonproj%5D%5CProject%20Administrators azext_devops.devops_sdk.client : Request content: None msrest.universal_http : Configuring redirects: allow=True, max=30 msrest.universal_http : Configuring request: timeout=100, verify=True, cert=None msrest.universal_http : Configuring proxies: '' msrest.universal_http : Evaluate proxies against ENV settings: True urllib3.connectionpool : https://myorg.vssps.visualstudio.com:443 "PUT /_apis/Graph/Memberships/aad.MjhhYzI0NDktOGUxMC03NjJhLTg5MzgtOTNlZDEzYTU5OWM1/%5Bmonproj%5D%5CProject%20Administrators HTTP/1.1" 404 15 msrest.exceptions : Page not found. Operation returned an invalid status code of 404. handling generic error cli.azure.cli.core.util : request failed: Page not found. Operation returned an invalid status code of 404. request failed: Page not found. Operation returned an invalid status code of 404. az_command_data_logger : exit code: 1 telemetry.save : Save telemetry record of length 2570 in cache telemetry.check : Negative: The /home/mathieu/.azure/telemetry.txt was modified at 2019-09-03 12:20:26.214619, which in less than 600.000000 s command ran in 1.379 seconds.

ishitam8 commented 5 years ago

Hi @mathieugravil ,

To add a member to some group, you need to pass descriptor of that group and not group name . You can fetch the group descriptor by running group list command with query something similar to this az devops security group list -p monproj -o json --query "graphGroups[?displayName == 'Project Administrators'].descriptor | [0]" -o tsv

You can use this descriptor to add members to the group. az devops security group membership add --group-id <YOUR_GROUP_DESCRIPTOR> --member-id "myuser.toto@mycomp.com" --organization "https://dev.azure.com/myorg"

Let me know if this helps

mathieugravil commented 5 years ago

ok it works. Thanks forr you help.