MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.25k stars 21.42k forks source link

I am getting errors when I run the example azcommands #120720

Closed tyler-suard-parker closed 3 months ago

tyler-suard-parker commented 7 months ago

One example you give: az cosmosdb mongodb user definition create --account-name --resource-group --body {\"Id\":\"test.myName\",\"UserName\":\"myName\",\"Password\":\"pass\",\"DatabaseName\":\"test\",\"CustomData\":\"Some_Random_Info\",\"Mechanisms\":\"SCRAM-SHA-256\",\"Roles\":[{\"Role\":\"My_Read_Only_Role101\",\"Db\":\"test\"}]}

I copied and pasted this, then changed the names to my correct ones. I pressed enter and I got this error message:

At line:1 char:135 ... ource-group my-resource-group --body {\"Id\":\"test.myName\",\"UserNa ... ~ Missing argument in parameter list. At line:1 char:338 ... hanisms\":\"SCRAM-SHA-256\",\"Roles\":[{\"Role\":\"dbOwner\",\"Db\":\ ... ~ Missing argument in parameter list.

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

ManoharLakkoju-MSFT commented 7 months ago

@tyler-suard-parker It would be great if you could add a link to the documentation you are following for these steps? This would help us redirect the issue to the appropriate team. Thanks!

tyler-suard-parker commented 7 months ago

@ManoharLakkoju-MSFT Sorry, here is the link: https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/how-to-setup-rbac

ManoharLakkoju-MSFT commented 7 months ago

@tyler-suard-parker Thanks for your feedback! We will investigate and update as appropriate.

seesharprun commented 3 months ago

Thank you for reaching out,

Unfortunately, this is the documentation GitHub repository, and we cannot troubleshoot issues, answer product questions, or provide technical support.

For technical support, please open a support ticket in the Azure portal. For questions about the product, please post them in Microsoft Q&A.

Looking briefly at your issue, it seems like you have an inline JSON encoding error. You can either use the @ syntax to read a JSON file, or do inline JSON in bash using this syntax:

az cosmosdb mongodb user definition create --account-name <account-name> --resource-group <resource-group-name> --body '{
  "Id": "<database-name>.<username>",
  "UserName": "<username>",
  "Password": "<password>",
  "DatabaseName": "<database-name>",
  "CustomData": "created-by-docs",
  "Mechanisms": "SCRAM-SHA-256",
  "Roles": [
    {
      "Role": "read",
      "Db": "<database-name>"
    }
  ]
}'

please-close