Under "Back up a persistent volume" topic, the command use does not work
az disk list --query '[].id|[?contains(@,pvc-a844d47a-a673-11e8-ba75-dec015575cfb)]' -o tsv
az : '[?contains' is not recognized as an internal or external command,
At line:1 char:1
operable program or batch file.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Command that works for me
az disk list --query '[].id | [?contains(@,pvc-a844d47a-a673-11e8-ba75-dec015575cfb)]'
Thanks for the feedback! We are currently investigating and will update you shortly.
@hafizramly I ran through this doc using the Azure Cloud Shell and it ran as written
micah@Azure:~$ az disk list --query '[].id|[?contains(@,`pvc-86009e4e-a70d-11e8-af07-0a58ac1f1d4b`)]' -o tsv
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/MC_MYAKSCLUSTER_MYAKSCLUSTER_EASTUS/providers/Microsoft.Compute/disks/kubernetes-dynamic-pvc-86009e4e-a70d-11e8-af07-0a58ac1f1d4b
Are you running this from Azure CLI on premise? If so, you likely need to update to the lastest version of Azure CLI. That tends to be the problem when getting a error regarding recognizing a command.
The version of CLI used in Azure Cloud Shell currently is 2.0.44
You can check the version you are running use az --version
Try updating your Azure CLI and see if that helps. I will close for now as I have verified the doc works as written. If updating your CLI does not help let me know and we can reopen and continue.
@MicahMcKittrick-MSFT Yes I'm running these command on-prem. And below is my azure-cli version.
PS C:\Windows\system32> az --version
azure-cli (2.0.44)
acr (2.1.3)
acs (2.3.0)
advisor (0.6.0)
ams (0.2.2)
appservice (0.2.2)
backup (1.2.0)
batch (3.3.2)
batchai (0.4.1)
billing (0.2.0)
cdn (0.1.0)
cloud (2.1.0)
cognitiveservices (0.2.0)
command-modules-nspkg (2.0.2)
configure (2.0.18)
consumption (0.4.0)
container (0.3.3)
core (2.0.44)
cosmosdb (0.2.0)
dla (0.2.1)
dls (0.1.0)
dms (0.1.0)
eventgrid (0.2.0)
eventhubs (0.2.2)
extension (0.2.1)
feedback (2.1.4)
find (0.2.12)
interactive (0.3.28)
iot (0.3.0)
iotcentral (0.1.0)
keyvault (2.2.2)
lab (0.1.0)
maps (0.3.1)
monitor (0.2.2)
network (2.2.3)
nspkg (3.0.3)
policyinsights (0.1.0)
profile (2.1.1)
rdbms (0.3.0)
redis (0.3.0)
relay (0.1.0)
reservations (0.3.1)
resource (2.1.2)
role (2.1.3)
search (0.1.1)
servicebus (0.2.1)
servicefabric (0.1.1)
sql (2.1.2)
storage (2.2.0)
telemetry (1.0.0)
vm (2.2.1)
Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\ramlmimy.azure\cliextensions'
Python (Windows) 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]
Legal docs and information: aka.ms/AzureCliLegal
I'm experience a different success result when executing this command from PowerShell and cmd. But I guess probably due to my environmental setup issue.
Thanks @hafizramly. The commands won't work in PS but they should be fairly similar to on prem CLI.
I tried the same on prem and got the same results.
@iainfoulds can you take a look and see if we should add a note or something?
Could be when ran from a Windows host, only difference I see is the space either side of the | for '[].id and [?contains
@MicahMcKittrick-MSFT Can you validate that the extra doesn't break behavior in the Cloud Shell, please? That would indicate it's fine with the extra spacing on *nix-based machines. As with line wrappings on long commands, we try to avoid them to minimize problems when moving between OSes, but with some complex commands, that's not always possible. If the extra space is fine from the Cloud Shell, the doc can be updated.
@iainfoulds works fine with the spacing in Cloud Shell.
micah@Azure:~$ az disk list --query '[].id|[?contains(@,`pvc-86009e4e-a70d-11e8-af07-0a58ac1f1d4b`)]' -o tsv
/subscriptions/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX/resourceGroups/MC_MYAKSCLUSTER_MYAKSCLUSTER_EASTUS/providers/Microsoft.Compute/disks/kubernetes-dynamic-pvc-86009e4e-a70d-11e8-af07-0a58ac1f1d4b
micah@Azure:~$ az disk list --query '[].id | [?contains(@,`pvc-86009e4e-a70d-11e8-af07-0a58ac1f1d4b`)]' -o tsv
/subscriptions/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX/resourceGroups/MC_MYAKSCLUSTER_MYAKSCLUSTER_EASTUS/providers/Microsoft.Compute/disks/kubernetes-dynamic-pvc-86009e4e-a70d-11e8-af07-0a58ac1f1d4b
micah@Azure:~$ az disk list --query '[].id | [?contains(@,`pvc-86009e4e-a70d-11e8-af07-0a58ac1f1d4b`)]'
[
"/subscriptions/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX/resourceGroups/MC_MYAKSCLUSTER_MYAKSCLUSTER_EASTUS/providers/Microsoft.Compute/disks/kubernetes-dynamic-pvc-86009e4e-a70d-11e8-af07-0a58ac1f1d4b"
]
If that is all we need to change than I am happy to make the edit for you to take it off your plate
@MicahMcKittrick-MSFT If you could, that would be awesome. Should be a quick auto-merge change. Thanks.
@iainfoulds done and done.
@hafizramly I updated the doc. Once the PR merges this issue will close and the changes will go live in a few hours.
Thanks @MicahMcKittrick-MSFT!
Most helpful comment
@iainfoulds done and done.
@hafizramly I updated the doc. Once the PR merges this issue will close and the changes will go live in a few hours.