azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Api-version 2020-03-01 is not supported

Open droessmj opened this issue 6 years ago • 4 comments

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug Az CLI defaults to using an API version not yet supported by the ARM backend.

To Reproduce

  1. Azure DevOps hosted agent windows-2019
  2. Az CLI v. 2.1.0.
  3. Run the following command
az storage account network-rule add --account-name $targetResourceName --resource-group $targetResourceGroup --subnet $sourceSubnetId
  1. Error returned: "Api-version 2020-03-01 is not supported"

Expected behavior Subnet is added as allowed to target storage account resource.

Environment summary See steps to reproduce.

Additional context Issue began on 3/2 without changes to code. Only identified changes are Az CLI version using on agent.

droessmj avatar Mar 04 '20 14:03 droessmj

HI @Juliehzl could you pls have a look? thanks

yungezz avatar Mar 05 '20 00:03 yungezz

add to S167

yonzhan avatar Mar 05 '20 01:03 yonzhan

Original input is inaccurate. Further digging on our end has actually narrowed the call down to this function, where the resourceId parameter is a fully qualified subnetId.

function Wait-ResourceProvisioningState{
    param(
        [Parameter(Mandatory=$true)][string]$resourceId, 
        [Parameter(Mandatory=$false)][string]$desiredState = "Succeeded" 
    )

    $info = $(az resource show --ids $resourceId) | ConvertFrom-JSON
    if (!$info.properties.provisioningState){
        Write-Warning "Passed resource does not expose a provisioningState field." 
    }else{
        $i = 0
        while($info.properties.provisioningState -ne $desiredState -and $i -lt $CONST_MAX_ATTEMPTS){
            Write-Verbose "Desired state '$desiredState' not found for '$resourceId'. Will re-attempt in $CONST_SLEEP_TIME seconds..." -Verbose
            Start-Sleep $CONST_SLEEP_TIME
            $info = $(az resource show --ids $resourceId) | ConvertFrom-JSON
            $i++
        }
    }
    return $info
}

Behavior appears to be intermittent, leading me to believe it's an inconsistency in the backend ARM provider rather than an issue inherent with the CLI itself.

droessmj avatar Mar 05 '20 14:03 droessmj

Behavior is no longer occurring, again believed to be a backend issue. Closing issue.

droessmj avatar Mar 06 '20 13:03 droessmj