Search code examples
azureazure-storageazcopy

AzCopy Sync command is failing


I'm issuing this command:

azcopy sync "D:\Releases\Test\MyApp" "http://server3:10000/devstoreaccount1/myapp?sv=2019-02-02&st=2020-06-24T03%3A19%3A44Z&se=2020-06-25T03%3A19%3A44Z&sr=c&sp=racwdl&sig=REDACTED"

...and I'm getting this error:

error parsing the input given by the user. Failed with error Unable to infer the source 'D:\Releases\Test\MyApp' / destination 'http://server3:10000/devstoreaccount1/myapp?sv=2019-02-02&st=2020-06-24T03%3A19%3A44Z&se=2020-06-25T03%3A19%3A44Z&sr=c&sp=racwdl&sig=-REDACTED-

I would have thought my source was pretty clear.

Can anyone see anything wrong with my syntax?


Solution

  • I believe you have run into an issue with azcopy that it does not support local emulator (at least for sync command). There's an open issue on Github for the same: https://github.com/Azure/azure-storage-azcopy/issues/554.

    Basically the issue is coming from the following lines of code, where it returns location as Unknown in case of storage emulator URLs:

    func inferArgumentLocation(arg string) common.Location {
        if arg == pipeLocation {
            return common.ELocation.Pipe()
        }
        if startsWith(arg, "http") {
            // Let's try to parse the argument as a URL
            u, err := url.Parse(arg)
            // NOTE: sometimes, a local path can also be parsed as a url. To avoid thinking it's a URL, check Scheme, Host, and Path
            if err == nil && u.Scheme != "" && u.Host != "" {
                // Is the argument a URL to blob storage?
                switch host := strings.ToLower(u.Host); true {
                // Azure Stack does not have the core.windows.net
                case strings.Contains(host, ".blob"):
                    return common.ELocation.Blob()
                case strings.Contains(host, ".file"):
                    return common.ELocation.File()
                case strings.Contains(host, ".dfs"):
                    return common.ELocation.BlobFS()
                case strings.Contains(host, benchmarkSourceHost):
                    return common.ELocation.Benchmark()
                    // enable targeting an emulator/stack
                case IPv4Regex.MatchString(host):
                    return common.ELocation.Unknown()//This is what gets returned in case of storage emulator URL.
                }
    
                if common.IsS3URL(*u) {
                    return common.ELocation.S3()
                }
            }
        }
    
        return common.ELocation.Local()
    }