MintuS
MintuS

Reputation: 1

Issue with New-AzStorageDirectory -Directory "" -Path ""

$directory = New-AzStorageDirectory -Directory $parentDirectory -Path $directoryName I am getting below error-

New-AzStorageDirectory : Cannot bind parameter 'Directory'. Cannot convert the "" value of type "System.String" to type "Microsoft.Azure.Storage.File.CloudFileDirectory". At C:\PROJECT\EngagePowerShellScript\StorageAccountFileShare.ps1:67 char:41

Thanks

Upvotes: 0

Views: 647

Answers (1)

Daniel Björk
Daniel Björk

Reputation: 2507

Directory needs to be of the type CloudFileDirectory so its not a string. In your case if you are creating a root directory you dont need to specify that parameter.

New root folder:

New-AzStorageDirectory -ShareName "ContosoShare06" -Path "ContosoWorkingFolder"

-Directory Specifies a folder as a CloudFileDirectory object. This cmdlet creates the folder in the location that this parameter specifies. To obtain a directory, use the New-AzStorageDirectory cmdlet. You can also use the Get-AzStorageFile cmdlet to obtain a directory.

More information can be found in Microsofts Documentation: https://learn.microsoft.com/en-us/powershell/module/az.storage/new-azstoragedirectory?view=azps-4.4.0

Upvotes: 0

Related Questions