Azure / azure-cli

Azure Command-Line Interface
MIT License
3.98k stars 2.96k forks source link

--subnet does not work in VS code/Gitbash #23918

Open Candelit opened 2 years ago

Candelit commented 2 years ago

Hi.

There seems to be some kind of general bug somewhere in either VS code, gitbash or the az module. Wherever resourceid for subnet is used the cli command will fail if it is run in VS code

The documentation states that --subnet is name or resource id... When it comes to running this in CloudShell, it is correct, but in VS code it fails. I have now tested with a storage account and a VM and same thing.

This is what happens: SUBNET_ID=$(az network vnet subnet show --resource-group $VNET_RESOURCE_GROUP --name $SUBNET1 --vnet-name $VNET --query id -o tsv) az storage account create \

--name $STORAGEACCOUNT_NAME \
--resource-group $SYNAPSE_RESOURCE_GROUP \
--location $REGION \
--sku Standard_LRS \
--kind StorageV2 \
--enable-hierarchical-namespace \
--min-tls-version TLS1_2 \
--subnet $SUBNET_ID

←[91mincorrect usage: [--subnet ID | --subnet NAME --vnet-name NAME]←[0m

And as I said, the same always works fine i CloudShell (It is not the ID get that is the problem, that works. It makes no difference if I type or paste it in as a string)

Thanks // Thomas Odell Balkeståhl


Dokumentinformation

Redigera inte det här avsnittet. Det krävs för docs.microsoft.com ➟ länkning till GitHub-problem.

yonzhan commented 2 years ago

@evelyn-ys for awareness

evelyn-ys commented 2 years ago

Can you add --debug and see the real argument values passed in? Sounds like issue of https://github.com/Azure/azure-cli/blob/dev/doc/use_cli_with_git_bash.md#auto-translation-of-resource-ids

ghost commented 2 years ago

Thank you for your feedback. This has been routed to the support team for assistance.

Candelit commented 2 years ago

Hi. This was it: POSIX-to-Windows path conversion will kick in Adding MSYS_NO_PATHCONV=1 before the command solved it, BIG thanks.

How do I set it permamently?

Thanks // THomas