Reputation: 4523
When I open up Bash in Azure Cloud Shell, I am able to create and edit new files and directories.
But when I try to do it in the PowerShell verison of Azure Cloud Shell, I am not able to do any of those things.
For example, when I try to create a new file:
Azure:/
PS Azure:\> new-item -Type file -Path my_new_files.txt
new-item : The node at path 'AzurePSDrive#Azure/my_new_files.txt' does not support the cmdlet 'New-Item'
At line:1 char:1
+ new-item -Type file -Path my_new_files.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotImplemented: (AzurePSDrive#Azure/my_new_files.txt:String) [New-Item], NodeDoesNotSupportCmdletException
+ FullyQualifiedErrorId : NewItem.NotSupported,Microsoft.PowerShell.Commands.NewItemCommand
And when I try to cd into a directory which I already created from the Bash shell:
Azure:/
PS Azure:\> ls
clouddrive jjj jjj.txt
Azure:/
PS Azure:\> cd jjj
cd : Cannot find path 'Azure:/jjj' because it does not exist.
At line:1 char:1
+ cd jjj
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (Azure:/jjj:String) [Set-Location], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
Why can I mkdir, touch, cd, and vi in Bash, but none of the file/directory commands seem to work in PowerShell?
Upvotes: 0
Views: 1006
Reputation: 2589
It's a known issue. Azure: has a virtual mapping to your home directory. The home directory is stored in a variable called $HOME.
Most of the PowerShell cmdlets don't play nicely with the Azure:\ alias. To overcome this just type:
cd $HOME
Once your in the home directory your cmdlets will work as you have written.
Upvotes: 2