I am trying to create file system in existing storage account (data lake gen2). I don't know what is the issue in the code that i am trying to execute. I was looking for solution but couldn't find any.
Here is the code:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
#name of created storage account
$accountName = 'multiprotocoladls2'
#name of file system that i want to create in existing storage account
$fsName= 'multiprotoadls2fs'
$token = 'here is my token'
$header = @{
"Content-Length"="0";
"x-ms-version"="2018-11-09";
"Authorization"="Bearer $token"
}
$uri = "https://$accountName.dfs.core.windows.net/" + $fsName + "?resource=filesystem"
Write-Host $uri
Invoke-RestMethod -Uri $uri -Method 'PUT' -Headers $header
I am getting following error:
Invoke-RestMethod : {"error":{"code":"AuthenticationFailed","message":"Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly includin
g the signature.\nRequestId:723b78a9-a01f-002e-6973-5801e3000000\nTime:2019-08-21T22:53:41.6191544Z"}}
I have no idea why. I checked parameters in header etc, tried to do everything according to documentation.
https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/filesystem/create
Can anyone give me a clue how can i overcome this issue?