$Context = (Get-AzStorageAccount -ResourceGroupName "TestServices-RG" -Name "devstestsa").Context
$file=Get-AZStorageFile -ShareName "test-file-share" -Context $Context -Path "/test.json"
The above command works but it throws error if file does not exist. Is there any way to suppress this error.
Error: The specified resource does not exist. HTTP Status Code: 404 - HTTP Error Message: The specified resource does not exist. ErrorCode: | ResourceNotFound ErrorMessage: The specified resource does not exist. RequestId: 50521f9b-701a-0034-6a8a-fba24a000000 Time: Fri, 05 Feb 2021 | 12:12:22 GMT
Get-AzStorageFile: untitled:Untitled-1:4:10 Line | 4 | $file=Get-AZStorageFile -ShareName "test-file-share" -Context … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The specified resource does not exist. HTTP Status Code: 404 - HTTP Error Message: The specified resource does not exist. ErrorCode: | ResourceNotFound ErrorMessage: The specified resource does not exist.