1
votes

I am using @azure-tools/azcopy-node npm package to preforme copy between two storage accounts.
I have the below code (tried both with SAS token and storage connection string) and i'm getting the following error:
"failed to perform copy command due to error: no SAS token or OAuth token is present and the resource is not public"

    var client = new AzCopyClient();

    const src = <IRemoteKeyLocation>{
        resourceUri: "https://srcaccount.blob.core.windows.net/",
        accountKey: "xxxxx",
        accountName: "srckey",
        path: "somepath"
    }

    const dst = <IRemoteKeyLocation>{
        resourceUri: "https://dststorage.blob.core.windows.net/",
        accountName: "dstacount",
        accountKey: "xxxxx",
        path: "copy-test"
    }
    var jobId = await client.copy(src, dst, {recursive: true});

1
According to the IRemoteKeyLocation definition, please try to put the container_name at the end of the resourceUri, and no trailing slashes.Ivan Yang
adding the container_name at the and of the resource uri and using the sas token instead of account name and key fixed the issue for meilanak

1 Answers

1
votes

According to the IRemoteKeyLocation definition, please try to put the container_name at the end of the resourceUri, and no trailing slashes.

Then use the sas_token instead of account name/key.