Permission denied error while accessing files under mount point via local file system API in Azure Synapse Notebook - azure-synapse

Working from Azure Synapse Notebook, I have mounted the ADLS Gen2 folder using LinkedServiceA as per below command,
mssparkutils.fs.mount(
"abfss://<CONTAINER>#<STORAGENAME>.dfs.core.windows.net/", #ADLS GEN 2 PATH
"/adlsmount", #Mount Point Name
{ "linkedService" : "<REPLACE LINKED SERVICE NAME>"})
I am trying to access the mount path using the local file system API as below.
Folder structure is like container/team/SALES/BILLING/YEAR.
LinkedServiceA that is used to create the mount is having access to only SALES and its subfolders.
import os
jobId = mssparkutils.env.getJobId()
synfs_bill_path = f'synfs:/{jobId}/adlsmount/team/SALES/BILLING/YEAR' #SYNFS
local_bill_path= f'/synfs/{jobId}/adlsmount/team/SALES/BILLING/YEAR' #Local File System
mssparkutils.fs.ls(synfs_bill_path) #this is working
bills = os.listdir(local_bill_path) #this is failing with permission denied error
But i am able to list all the parent directories using Local File System API Path using os lib
local_base_path= f'/synfs/{jobId}/adlsmount/team/SALES/'
bills = os.listdir(local_base_path) #this is working,
print(bills ) #lists "BILLING" folder
Error Message
PermissionError: [Errno 13] Permission denied: '/synfs/152/adlsmount/team/SALES/BILLING/YEAR'
Traceback (most recent call last):
Spark API using synfs_bill_path is also working. I wanted to process large number of small files in the SALES/BILLING/YEAR to reduce the number of files.(spark read fails with large number of files)

I have tried to repro your code in my lab environment and your code works fine without any errors for me.
Permission denied [Errno 13] is mostly seen when you try to access a path without having the necessary permissions. Please make sure the user has all the necessary permissions.

Related

SQL server : mapping network drive - Insufficient system resources exist to complete the requested service

Hello I am trying to create a new plan on SQL server to backup all my database.
My goal is to backup them to a network drive thus if I do have some trouble with my server, I will be able to restore databases to other server thanks to backup present in the network drive.
When my plan is executed, I do have some error so I try to execute manually the relative query.
After some investigation, it seems even net use command doesn't work (whereas it is working and I do it from cmd)
EXEC XP_CMDSHELL 'net use Z: \\ServerName\loggin/user:loggin password'
error is
System error 1450 has occurred. Insufficient system resources exist to complete the requested service.
Beside, I do have another server where it is working so I suppose some configuration missing but can't find them
as my network drive is also accessible via FTP, I chose this way to make the job : create a batch file that run winscp and use this batch file in a SQL agent job . I need to add right to batch file to SQL Server agent account. I also need to define a credential and a proxy to be used in the job.

Access BigQuery data from Jupyter Notebook in AI Platform Google Cloud

I am trying to get access to the data stored in BigQuery from Jupyter Notebook in AI Platform on Google cloud platform.
First, I tried the following code:
from google.cloud import bigquery
from google.oauth2 import service_account
credentials = service_account.Credentials.from_service_account_file(r'\local_path\gcpcred.json')
project_id = 'my-bq'
client = bigquery.Client(credentials= credentials,project=project_id)
The authentication credentials are stored in a json file named gcpcred on the local machine but
this gives me an error saying
FileNotFoundError: [Errno 2] No such file or directory:
'\local_path\gcpcred.json
I thought that since I am running this in AI Platform(on the cloud itself), I would not have to use this API and authenticate.
So I simply wrote:
%%bigquery
SELECT * FROM `project.dataset.table` LIMIT 1000
I got an error saying
ERROR:
403 Access Denied: User does not have access to the table
How do I access the table? Please help
Seems like the service account assosiated with jupyter notebooks doesn't have enough privilage to access bigquery. You can update it in IAM service Account section with required privilages.
The links Bellow will provide further clarification:
Visualizing BigQuery data in a Jupyter notebook
Getting started with authentication

ADLS to Azure Storage Sync Using AzCopy

Looking for some help to resolve the errors I'm facing. Let me explain the scenario. I'm trying to sync one of the ADLS Gen2 container to Azure BLOB Storage. I have AzCopy 10.4.3, I'm using Azcopy Sync to do this. I'm using the command below
azcopy sync 'https://ADLSGen2.blob.core.windows.net/testsamplefiles/SAMPLE' 'https://AzureBlobStorage.blob.core.windows.net/testsamplefiles/SAMPLE' --recursive
When I run this command I'm getting below error
REQUEST/RESPONSE (Try=1/71.0063ms, OpTime=110.9373ms) -- RESPONSE SUCCESSFULLY RECEIVED
PUT https://AzureBlobStorage.blob.core.windows.net/testsamplefiles/SAMPLE/SampleFile.parquet?blockid=ZDQ0ODlkYzItN2N2QzOWJm&comp=block&timeout=901
X-Ms-Request-Id: [378ca837-d01e-0031-4f48-34cfc2000000]
ERR: [P#0-T#0] COPYFAILED: https://ADLSGen2.blob.core.windows.net/testsamplefiles/SAMPLE/SampleFile.parquet: 404 : 404 The specified resource does not exist.. When Staging block from URL. X-Ms-Request-Id: [378ca837-d01e-0031-4f48-34cfc2000000]
Dst: https://AzureBlobStorage.blob.core.windows.net/testsamplefiles/SAMPLE/SampleFile.parquet
REQUEST/RESPONSE (Try=1/22.9854ms, OpTime=22.9854ms) -- RESPONSE SUCCESSFULLY RECEIVED
GET https://AzureBlobStorage.blob.core.windows.net/testsamplefiles/SAMPLE/SampleFile.parquet?blocklisttype=all&comp=blocklist&timeout=31
X-Ms-Request-Id: [378ca84e-d01e-0031-6148-34cfc2000000]
So far I checked and ensured below things
I logged into correct tenant while logging into AzCopy
Storage Blob Data Contributor role was granted to my AD credentials
Not sure what else I'm missing as the file exists in the source and I'm getting the same error. I tried with SAS but I received different error though. I cannot proceed with SAS due to the vendor policy so I need to ensure this is working with oAuth. Any inputs is really appreciated.
For the 404 error, you may check if there is any typo in the command and the path /testsamplefiles/SAMPLE exists on both source and destination account. Also, please note that from the tips.
Use single quotes in all command shells except for the Windows Command
Shell (cmd.exe). If you're using a Windows Command Shell (cmd.exe),
enclose path arguments with double quotes ("") instead of single
quotes ('').
From azcopy sync supported scenario:
Azure Blob <-> Azure Blob (Source must include a SAS or is publicly
accessible; either SAS or OAuth authentication can be used for
destination)
We must provide include a SAS token in the source, but I tried the below code with AD authentication.
azcopy sync "https://[account].blob.core.windows.net/[container]/[path/to/blob]?[SAS]" "https://[account].blob.core.windows.net/[container]/[path/to/blob]"
but got the same 400 error as the Github issue.
Thus, in this case, after my validation, you could use this command to sync one of the ADLS Gen2 container to Azure BLOB Storage without executing azcopy login. If you have login in, you can run azcopy logout.
azcopy sync "https://nancydl.blob.core.windows.net/container1/sample?sv=xxx" "https://nancytestdiag244.blob.core.windows.net/container1/sample?sv=xxx" --recursive --s2s-preserve-access-tier=false

Accesing windows server 64 bits Registry info using citrix

trying to save file using Powerbuilder Datawindow Save As function
for path we are using
RegistryGet( "HKEY_CURRENT_USER\Software\Microsoft\windows\currentversion\explorer\shell folders", "Desktop", RegString!, ls_ret)
but when we login through citrix.
Not able to get this path.
When looged in as administrator getting this path but for other users we are not getting the path .
We also given full permission to particularly this registry but still not getting.
This does not seem to be Citrix specific, to simplify, add a user to Remote Desktop group and login directly via RDP (without Citrix), you should get the same behavior

Access denied while loading from gcs to bigquery

I have uploaded a csv file to gcs and I can list/view that file using "gsutil(ls and cat)". I can even load that file using "bq load" but when I try to load it from the python loadTable script mentioned in the examples, it fails with the error message "Access Denied"
{u'state': u'DONE', u'errors': [{u'reason': u'accessDenied', u'message': u'Access Denied: File (file_name): Access Denied'}], u'errorResult': {u'reason': u'accessDenied', u'message': u'Access Denied: File (file_name): Access Denied'}}
Done Loading!
The authorization used is through "Service account" key. I have tested the listing of dataset and the table. Its just the upload through gcs which says "Access Denied".
Please help.
Does the service account have read access to the google storage file? Can you send the job id of the failed load job?