question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(InvalidApiVersionParameter) The api-version '2020-07-01-preview' is invalid.

See original GitHub issue

Related command az policy exemption create -n "Exempt_<SNOWINC>_Tags_<RSGName>" --policy-assignment "/providers/Microsoft.Management/managementGroups/<MGName>/providers/Microsoft.Authorization/policyAssignments/<AssignmentName>" --exemption-category "Waiver" --resource-group "/subscriptions/<SubGUID>/resourceGroups/<RSGName>" --expires-on "2022-06-02T00:00:00Z"

Describe the bug Using most-recent AZ CLI (and immediately previous version):

PS C:\Users\brian.pickering> az version
{
  "azure-cli": "2.37.0",
  "azure-cli-core": "2.37.0",
  "azure-cli-telemetry": "1.0.6",
  "extensions": {
    "account": "0.2.3",
    "aks-preview": "0.5.76",
    "automation": "0.1.1"
  }
}

Receiving the following error response to the command given above:

Command group 'policy exemption' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
(InvalidApiVersionParameter) The api-version '2020-07-01-preview' is invalid. The supported versions are '2022-05-01,2022-03-01-preview,2022-01-01,2021-04-01,2021-01-01,2020-10-01,2020-09-01,2020-08-01,2020-07-01,2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'.
Code: InvalidApiVersionParameter
Message: The api-version '2020-07-01-preview' is invalid. The supported versions are '2022-05-01,2022-03-01-preview,2022-01-01,2021-04-01,2021-01-01,2020-10-01,2020-09-01,2020-08-01,2020-07-01,2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'.

To Reproduce Run the command as specified above (of course, one needs to replace the descriptive “macros” given in <>.)

Expected behavior Create exemption on the policy initiative.

Environment summary Found error on previous version of az cli, updated to current version, error remained the same.

Additional context N/A

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
BigBearBriancommented, Jun 8, 2022

OK, found the problem. Was giving parameter --resource-group in the full URI format (/subscriptions/<subID>/resourceGroups/<rsgName>) instead of simply giving just the Resource Group name. When I entered ONLY the Resource Group name, the exemption got created.

Sorry to have wasted your time.

1reaction
robgacommented, Jun 8, 2022

@zhoxing-ms There is correlationId in the debug log you shared. The Uri format is incorrect. It should be the client issue. Will send you the query via email.

Read more comments on GitHub >

github_iconTop Results From Across the Web

InvalidApiVersionParameter : The api-version '2018-05-01' is ...
I can't go back to Hosted agent becuase there are certain resources in my release pipeline that uses the higher version of the...
Read more >
InvalidApiVersionParameter error using Microsoft.Azure ...
But now I am getting this error: "code": "InvalidApiVersionParameter", "message": "The api-version '2017-04-01' is invalid.
Read more >
Azure manage compute API is failing with InvalidAPIVersion ...
Error message: InvalidApiVersionParameter: The api-version '2015-05-01-preview' is invalid. The supported versions are '2015-01-01,2014-04-01- ...
Read more >
The negative externality of badly written SDKs - AI | Elastacloud
{"error":{"code":"InvalidApiVersionParameter","message":"The api-version '2020-04-01-preview' is invalid. The supported versions are ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found