MicrosoftDocs / azure-docs

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

Examples have body in wrong format that gives errors to customer. #116397

Closed ankkp closed 7 months ago

ankkp commented 1 year ago

[Enter feedback here]

below is in doc and it is wrong az rest --method Put --uri /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttestRg/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest/sqlVulnerabilityAssessments/default?api-version=2022-02-01-preview --body '{ \"properties\": { \"state\": \"Disabled\" }}'

It should be like below. az rest --method Put --uri /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttestRg/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest/sqlVulnerabilityAssessments/default?api-version=2022-02-01-preview --body '{ "properties": { "state": "Disabled" }}'

same need to be updated for enabling example

Document Details

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

ManoharLakkoju-MSFT commented 1 year ago

@ankkp Thanks for your feedback! We will investigate and update as appropriate.

dcurwin commented 1 year ago

reassign:dcurwin

dcurwin commented 1 year ago

label:"backlog-item-created"

dcurwin commented 9 months ago

reassign:alizabernstein

TPavanBalaji commented 7 months ago

@dbradish-microsoft Could you please review it.

dbradish-microsoft commented 7 months ago

@ankkp, @TPavanBalaji It looks to me like there is a quoting difference between Bash and PowerShell environments. Please take a look at these three docs, one of which is dedicated to az rest.

Script example if you are executing Azure CLI in Bash:

az rest --method patch \
        --url https://management.azure.com/subscriptions/<mySubscriptionID>/resourceGroups/<myResourceGroup>/providers/Microsoft.HybridCompute/machines/<machineName>?api-version=yyyy-mm-dd-preview \
        --resource https://management.azure.com/ \
        --headers Content-Type=application/json \
        --body '{"properties": {"agentUpgrade": {"enableAutomaticUpgrade": false}}}'

Script example if you are executing Azure CLI in PowerShell:

az rest --method patch `
        --url https://management.azure.com/subscriptions/<mySubscriptionID>/resourceGroups/<myResourceGroup>/providers/Microsoft.HybridCompute/machines/<machineName>?api-version=yyyy-mm-dd-preview `
        --resource https://management.azure.com/ `
        --headers Content-Type=application/json `
        --body '{\"properties\": {\"agentUpgrade\": {\"enableAutomaticUpgrade\": false}}}'
dbradish-microsoft commented 7 months ago

please-close