0

I am running simple ps cmdlets to connect to azure datalake gen2 storage, some of the cmdlets are working and authenticating through corporate proxy (powershell is configured to use proxy on my machine). however some commands are failing with "Proxy Authentication is required".

Can someone share ideas or reason or fix ?

 $subscription = "subscription"
 $storageAccount = "storage"
 $filesystem = "rawdata"
 Connect-AzAccount -Subscription $subscription | Out-Null
 $context = New-AzStorageContext -StorageAccountName $storageAccount -UseConnectedAccount   

Below commands are throwing an error

Get-AzDataLakeGen2Item -Context $ctx -FileSystem $fileSystem
Get-AzDataLakeGen2ChildItem -Context $context -FileSystem $fileSystem 

Get-AzDataLakeGen2ChildItem : Proxy Authentication Required At line:1 char:1

  • Get-AzDataLakeGen2ChildItem -Context $ctx
  •   + CategoryInfo          : CloseError: (:) [Get-AzDataLakeGen2ChildItem], RequestFailedException
      + FullyQualifiedErrorId : RequestFailedException,Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzDataLakeGen2ChildItemCommand
    

But this command is working fine.

Get-AzDatalakeGen2FileSystem -Context $ctx
Bala Murali
  • 105
  • 2
  • 13

1 Answers1

0

One of the workaround for connecting to the Azure Data Lake Gen2 Storage account using PowerShell through Proxy by using following Code:

 $browser = New-Object System.Net.WebClient
 $browser.Proxy.Credentials =[System.Net.CredentialCache]::DefaultNetworkCredentials 

Run this Code before connecting to the Azure Account.

I have executed this code to list the files available in the directory of my container in Azure Data Lake Gen2 Storage locally (Windows PowerShell ISE)

Windows PowerShell ISE:

enter image description here

Reference: Access web using PowerShell and Proxy