Azure / azure-cli

Azure Command-Line Interface
MIT License
3.99k stars 2.97k forks source link

Documentation for "--web-redirect-uris" is incorrect #23533

Open martinellimakes opened 2 years ago

martinellimakes commented 2 years ago

The documentation for supplying --web-redirect-uris states "Space-separated values.". This appears to be incorrect and actually required comma separated values.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

yonzhan commented 2 years ago

@jiasli for awareness

Jasonlhy commented 2 years ago

I just installed azure cli with winget today and use az ad app update --web-redirect-uris , I think it accepts Space-separated values, but it doesn't accepts up to 255 values, it will prompt some messages like: "The command is too long"

jiasli commented 2 years ago

--web-redirect-uris only supports space-separated values:

https://github.com/Azure/azure-cli/blob/3e26929f7669c504a5720e7f63c4be729534d52e/src/azure-cli/azure/cli/command_modules/role/_params.py#L57-L60

> az ad app create --display-name azure-cli-test0823 --web-redirect-uris https://web1.com https://web2.com
{
  ...
  "web": {
    ...
    "redirectUris": [
      "https://web1.com",
      "https://web2.com"
    ]
  }
}

@martinellimakes, please share your full command and result. Thanks.

jiasli commented 2 years ago

@Jasonlhy, your error seems to be from the shell. Which shell you are using and could you share a screenshot?

ghost commented 2 years ago

Thank you for your feedback. This has been routed to the support team for assistance.

Jasonlhy commented 2 years ago

@jiasli I am using powershell 7.2.6, azure-cli 2.39.0

I don't have the screenshot of it, the command I am using is something like this up to 1xx values: az ad app update --id $aadClientId --web-redirect-uris "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback"

junchaw commented 1 year ago

For my understanding of "space separated values", I would try something like this:

az ad app update --id "xx" --web-redirect-uris "https://web1.com https://web2.com"

I would say it's better to tell users it's a list of string values and let the user decide how to pass them, whether to use space or comma, dependes on which shell they're using.

jiasli commented 1 year ago

@Jasonlhy, the error "The command is too long" is from PowerShell when invoking C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd, because

The maximum length of the string that you can use at the command prompt is 8191 characters. -- https://learn.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation

You get the same error when you run cmd.exe "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback" "https://xxxyyzzz-abcde-efgh.azurewebsites.net/.auth/login/aad/callback"...

As a workaround, you may save the payload of Create application or Update application in a local file and use az rest with --body @app.json to call these REST APIs directly. Examples can be found at #22580.

Previously I made a proposal in #23490 to support --parameters so that you can specify the payload of az ad app update (or even az ad app create) by yourself, but unfortunately that PR has not been planned or approved.

jiasli commented 1 year ago

@kacifer, the definition and usage of "space separated values" are documented at https://learn.microsoft.com/en-us/cli/azure/use-cli-effectively?tabs=bash%2Cbash2#use-quotation-marks-in-parameters

jiasli commented 1 year ago

I would say it's better to tell users it's a list of string values and let the user decide how to pass them, whether to use space or comma, dependes on which shell they're using.

No shell supports passing a list to native executables. Even the ${name[@]} array expansion converts values to individual arguments separated by spaces (first character of IFS) before calling an executable.