- Article
- 11 minutes to read
The Copy Blob From URL
operation copies a blob to a destination within the storage account synchronously for source blob sizes up to 256 mebibytes (MiB). This API is available starting in version 2018-03-28.
The source for a Copy Blob From URL
operation can be any committed block blob in any Azure storage account that's either public or authorized with a shared access signature.
Request
You can construct the Copy Blob From URL
request as follows. We recommend HTTPS. Replace myaccount with the name of your storage account, mycontainer with the name of your container, and myblob with the name of your destination blob.
PUT method request URI | HTTP version |
---|---|
https://myaccount.blob.core.windows.net/mycontainer/myblob | HTTP/1.1 |
URI for the emulated storage service
When you're making a request against the emulated storage service, specify the emulator host name and Azure Blob Storage port as 127.0.0.1:10000
, followed by the name of the emulated storage account:
PUT method request URI | HTTP version |
---|---|
http://127.0.0.1:10000/devstoreaccount1/mycontainer/myblob | HTTP/1.1 |
For more information, see Use the Azurite emulator for local Azure Storage development.
URI parameters
You can specify the following additional parameters on the request URI:
Parameter | Description |
---|---|
timeout | Optional. The timeout parameter is expressed in seconds. For more information, see Set timeouts for Blob Storage operations. |
Request headers
The following table describes required and optional request headers:
Request header | Description |
---|---|
Authorization | Required. Specifies the authorization scheme, account name, and signature. For more information, see Authorize requests to Azure Storage. |
Date or x-ms-date | Required. Specifies the Coordinated Universal Time (UTC) for the request. For more information, see Authorize requests to Azure Storage. |
x-ms-version | Required for all authorized requests. For more information, see Versioning for the Azure Storage services. |
x-ms-meta-name:value | Optional. Specifies a user-defined name/value pair associated with the blob. If no name/value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name/value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. For more information, see Naming and referencing containers, blobs, and metadata. |
x-ms-encryption-scope | Optional. Indicates the encryption scope for encrypting the request contents. This header is supported in version 2020-12-06 and later. |
x-ms-tags | Optional. Sets query-string-encoded tags on the blob. Tags are not copied from the copy source. For more information, see Remarks. Supported in version 2019-12-12 and later. |
x-ms-copy-source-tag-option | Optional. Possible values are REPLACE and COPY (case-sensitive). The default value is REPLACE .If
Supported in version 2021-04-10 and later. |
x-ms-source-if-modified-since | Optional. A DateTime value. Specify this conditional header to copy the blob only if the source blob has been modified since the specified date/time. If the source blob has not been modified, Blob Storage returns status code 412 (Precondition Failed). You can't specify this header if the source is an Azure file. |
x-ms-source-if-unmodified-since | Optional. A DateTime value. Specify this conditional header to copy the blob only if the source blob has not been modified since the specified date/time. If the source blob has been modified, Blob Storage returns status code 412 (Precondition Failed). You can't specify this header if the source is an Azure file. |
x-ms-source-if-match | Optional. An ETag value. Specify this conditional header to copy the source blob only if its ETag value matches the specified value. If the values don't match, Blob Storage returns status code 412 (Precondition Failed). You can't specify this header if the source is an Azure file. |
x-ms-source-if-none-match | Optional. An ETag value. Specify this conditional header to copy the blob only if its ETag value doesn't match the specified value. If the values are identical, Blob Storage returns status code 412 (Precondition Failed). You can't specify this header if the source is an Azure file. |
If-Modified-Since | Optional. A DateTime value. Specify this conditional header to copy the blob only if the destination blob has been modified since the specified date/time. If the destination blob has not been modified, Blob Storage returns status code 412 (Precondition Failed). |
If-Unmodified-Since | Optional. A DateTime value. Specify this conditional header to copy the blob only if the destination blob has not been modified since the specified date/time. If the destination blob has been modified, Blob Storage returns status code 412 (Precondition Failed). |
If-Match | Optional. An ETag value. Specify an ETag value for this conditional header to copy the blob only if the specified ETag value matches the ETag value for an existing destination blob. If the values don't match, Blob Storage returns status code 412 (Precondition Failed). |
If-None-Match | Optional. An ETag value, or the wildcard character (*). Specify an Specify the wildcard character (*) to perform the operation only if the destination blob doesn't exist. If the specified condition isn't met, Blob Storage returns status code 412 (Precondition Failed). |
x-ms-copy-source:name | Required. Specifies the URL of the source blob. The value can be a URL of up to 2 kibibytes (KiB) in length that specifies a blob. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or be authorized via a shared access signature. If the source blob is public, no authorization is required to perform the operation. If the size of the source blob is greater than 256 MiB, the request fails with a 409 (Conflict) error. The blob type of the source blob has to be block blob. Here are some examples of source object URLs: - |
x-ms-copy-source-authorization: <scheme> <signature> | Optional. Specifies the authorization scheme and signature for the copy source. For more information, see Authorize requests to Azure Storage. Only the scheme bearer is supported for Azure Active Directory. This header is supported in version 2020-10-02 and later. |
x-ms-requires-sync:true | Required. Indicates that this is a synchronous Copy Blob From URL operation instead of an asynchronous Copy Blob operation. |
x-ms-source-content-md5 | Optional. Specifies an MD5 hash of the blob content from the URI. This hash is used to verify the integrity of the blob during transport of the data from the URI. When this header is specified, the storage service compares the hash of the content that has arrived from the copy source with this header value. The MD5 hash is not stored with the blob. If the two hashes don't match, the operation fails with error code 400 (Bad Request). |
x-ms-lease-id:<ID> | Required if the destination blob has an active lease. The lease ID specified for this header must match the lease ID of the destination blob. If the request doesn't include the lease ID or it isn't valid, the operation fails with status code 412 (Precondition Failed). If this header is specified and the destination blob doesn't currently have an active lease, the operation fails with status code 412 (Precondition Failed). In version 2012-02-12 and later, this value must specify an active, infinite lease for a leased blob. A finite-duration lease ID fails with status code 412 (Precondition Failed). |
x-ms-client-request-id | Optional. Provides a client-generated, opaque value with a 1-KiB character limit that's recorded in the logs when logging is configured. We highly recommend that you use this header to correlate client-side activities with requests that the server receives. |
x-ms-access-tier | Optional. Specifies the tier to be set on the target blob. This header is for page blobs on a premium account only with version 2017-04-17 and later. For a full list of supported tiers, see High-performance premium storage and managed disks for VMs. This header is supported on version 2018-11-09 and later for block blobs. Block blob tiering is supported on Blob Storage or General Purpose v2 accounts. Valid values are Hot , Cool , Cold and Archive . Please note that Cold tier is currently in preview and is supported from Version 2021-12-02 and newer. For detailed information about block blob tiering, see Hot, cool, and archive storage tiers. |
Request body
None.
Response
The response includes an HTTP status code and a set of response headers.
Status code
A successful operation returns status code 202 (Accepted).
For information about status codes, see Status and error codes.
Response headers
The response for this operation includes the following headers. The response might also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.
Response header | Description |
---|---|
ETag | If the copy is complete, contains the ETag value of the destination blob. If the copy isn't complete, contains the ETag value of the empty blob created at the start of the copy. The |
Last-Modified | Returns the date/time that the copy operation to the destination blob finished. |
x-ms-request-id | Uniquely identifies the request that was made. You can use it to troubleshoot the request. For more information, see Troubleshoot API operations. |
x-ms-version | Indicates the version of Blob Storage that's used to execute the request. |
Date | A UTC date/time value that indicates the time at which the service sent the response. |
x-ms-copy-id: <id> | String identifier for this copy operation. |
x-ms-copy-status: <success> | Indicates the state of the copy operation. A value of success means that the operation finished successfully. |
x-ms-client-request-id | Can be used to troubleshoot requests and corresponding responses. The value of this header is equal to the value of the x-ms-client-request-id header, if it's present in the request and the value is at most 1,024 visible ASCII characters. If the x-ms-client-request-id header is not present in the request, this header won't be present in the response. |
x-ms-request-server-encrypted: true/false | Set to true if the contents of the request are successfully encrypted through the specified algorithm. Otherwise, the value is false . |
x-ms-encryption-scope | Returned if the request used an encryption scope, so the client can ensure that the contents of the request are successfully encrypted through the encryption scope. |
Response body
None.
Sample response
The following is a sample response for a request to copy a blob:
Response Status: HTTP/1.1 202 Accepted Response Headers: Last-Modified: <date> ETag: "0x8CEB669D794AFE2" Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 x-ms-request-id: cc6b209a-b593-4be1-a38a-dde7c106f402 x-ms-version: 2018-03-28 x-ms-copy-id: 1f812371-a41d-49e6-b123-f4b542e851c5 x-ms-copy-status: success Date: <date>
Authorization
This operation can be called by the account owner and by anyone with a shared access signature who has permission to write to this blob or its container.
Access to the source blob or file is authorized separately, as described in the details for the request header x-ms-copy-source
.
If a request specifies tags with the x-ms-tags
request header, the caller must meet the authorization requirements of the Set Blob Tags operation.
Remarks
The source and destination blob for a Copy Blob From URL
operation must be a block blob.
In version 2020-10-02 and later, Azure Active Directory authorization is supported for the source of the copy operation.
The Copy Blob From URL
operation always copies the entire source blob. Copying a range of bytes or set of blocks is not supported.
You can copy a source blob to a destination blob that has a different name. The destination blob can be an existing block blob, or it can be a new blob that the copy operation creates.
When you're copying from a block blob, all committed blocks and their block IDs are copied. Uncommitted blocks are not copied. At the end of the copy operation, the destination blob will have the same committed block count as the source.
The ETag
value for a block blob changes when the Copy Blob From URL
operation starts and when the operation finishes.
Copying blob properties and metadata
When a block blob is copied, the following system properties are copied to the destination blob with the same values:
Content-Type
Content-Encoding
Content-Language
Content-Length
Cache-Control
Content-MD5
(Video) Using Azure Blob Storage ExampleContent-Disposition
The source blob's committed block list is also copied to the destination blob. Any uncommitted blocks are not copied.
The destination blob is always the same size as the source blob, so the value of the Content-Length
header for the destination blob matches the value of that header for the source blob.
If the x-ms-tags
header provides tags for the destination blob, they must be query-string encoded. Tag keys and values must conform to the naming and length requirements specified in the Set Blob Tags operation.
The x-ms-tags
header can contain up to 2 kilobits of tags. If you need more tags, use the Set Blob Tags
operation.
If the x-ms-tags
header doesn't provide tags, then tags aren't copied from the source blob.
Copying a leased blob
The Copy Blob From URL
operation only reads from the source blob, so the lease state of the source blob doesn't matter.
Billing
The destination account of a Copy Blob From URL
operation is charged for one transaction to start the operation. The destination account also incurs one transaction for each request to the source of the copy operation.
The source account also incurs transaction costs. In addition, if the source and destination accounts reside in different regions (for example, US North and US South), bandwidth that you use to transfer the request is charged to the source storage account as egress. Egress between accounts within the same region is free.
When you copy a source blob to a destination blob that has a different name within the same account, you use additional storage resources for the new blob. The copy operation then results in a charge against the storage account's capacity usage for those additional resources.
See also
Authorize requests to Azure Storage
Status and error codes
Blob Storage error codes
Understanding how snapshots accrue charges
FAQs
How do I access Azure blob storage from URL? ›
You can also retrieve a blob using an HTTPS/HTTP request. One way to find the URL of the blob is by using the Azure portal by going to Home > Storage Account > Container > Blob > Properties. However, probably the easiest way is to find the blob in the Storage Explorer, right-click, then select 'Copy URL'.
How do I copy Azure blob storage? ›Copy a source file in the Azure File service to a destination blob. The destination blob can be an existing block blob, or can be a new block blob created by the copy operation. Copying from files to page blobs or append blobs is not supported. Copy a snapshot over its base blob.
How do I check my blob storage capacity? ›- Sign in to the Azure portal.
- Select Monitor from the left-hand pane in the Azure portal, and.
- Under the Insights section, select Storage Accounts (preview).
To get your account key, in the Azure portal, go to your storage account. Go to Settings > Access keys, select a key, and paste it into the AzCopy command. If the specified destination container does not exist, AzCopy creates it and uploads the file into it.
What URL format can blobs can be accessed from? ›Users or client applications can access objects in Blob Storage via HTTP/HTTPS, from anywhere in the world.
How do I extract a blob link? ›Right-click on the webpage and click “Inspect” in the menu. When the DevTools panel opens, click on the three vertical dots in the top-right corner and select the “double window” icon (Undock into a separate window). Press “Ctrl + F” on Windows or “Cmd + F” on Mac to find the blob URL.
How do I copy files to blob storage? ›- Generate a shared access signature to connect to azure blob storage.
- Create a container on the Azure blob storage.
- Upload files on the container.
- Upload the entire directory on the container.
- Upload specific files on the container.
The difference between both is AzCopy is a command-line utility designed for copying data to/from Microsoft Azure Blob, File, and Table storage, using simple commands designed for optimal performance.
Can you query blob storage? ›The Query Blob Contents operation applies a simple Structured Query Language (SQL) statement on a blob's contents and returns only the queried subset of the data. You can also call Query Blob Contents to query the contents of a version or snapshot.
What is the max size of blob? ›A BLOB (binary large object) is a varying-length binary string that can be up to 2,147,483,647 characters long.
What is the limit of Azure blob storage? ›
Resource | Target |
---|---|
Maximum size of single blob container | Same as maximum storage account capacity |
Maximum number of blocks in a block blob or append blob | 50,000 blocks |
Maximum size of a block in a block blob | 4000 MiB |
Maximum size of a block blob | 50,000 X 4000 MiB (approximately 190.7 TiB) |
- Navigate to File Shares.
- Click on the ellipsis on the file share and select "Edit quota"
- Enter the new file store size.
If you'd rather use a SAS token to authorize access to blob data, then you can append that token to the resource URL in each AzCopy command. For example: 'https://<storage-account-name>.blob.core.windows.net/<container-name><SAS-token>' .
How do I download from Azure blob storage using API? ›- Create the Azure Blob Storage. Create the Azure Blob Storage to store the files. ...
- Create an ASP.NET Core Web API project and connect it to the Azure Blob Storage. ...
- Implement the endpoints in the ASP.NET Core Web API project.
- Get an introduction to Azure Storage Explorer.
- Read an overview of AzCopy.
- Quickstart: Upload, download, and list blobs with PowerShell.
- Quickstart: Create, download, and list blobs with Azure CLI.
- Learn about: ...
- Learn what is Azure Data Factory.
- Use the REST APIs to transfer data.
You can get a container or blob URL by using the url property of the client object: ContainerClient. url.
Is blob URL safe? ›Blob URLs are considered unsafe #947.
How do I convert a blob URL to a normal URL? ›A URL that was created from a JavaScript Blob can not be converted to a "normal" URL. A blob: URL does not refer to data the exists on the server, it refers to data that your browser currently has in memory, for the current page.
What is blob in front of URL? ›The Blob object represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data. Blobs can represent data that isn't necessarily in a JavaScript-native format.
What is the endpoint URL for Blob service? ›The default endpoint for Blob storage is https://<mystorageaccount>.blob.core.windows.net. If you map a custom domain and subdomain such as www.contoso.com to the blob endpoint for your storage account, then your users can also access blob data in your storage account using that domain.
What is Blob HTTP URL? ›
The Blob object represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data. Blobs can represent data that isn't necessarily in a JavaScript-native format.
How do I find the URL of a Blob object? ›You can get a container or blob URL by using the url property of the client object: ContainerClient. url.
How do you get the path for Blob storage Azure? ›- Hover over your name and click Setup.
- In the Data Management section, click File Locations.
- Click Create.
- Complete the information in the Properties section. ...
- For the location type, select Azure Blob Storage.
- Complete the location information. ...
- Save the file location.
Syntax: fetch( url, // API endpoint { method:"", // HTTP Method (GET, POST, PUT, DELETE) body: {}, // Data to be sent }). then(response => { // handle the response }) . catch(e => { // handle the error });
What is an example of blob as URL? ›A blob URI looks like blob:http://example.com/550e8400-e29b-41d4-a716-446655440000 , with the end of the URI being a universally unique identifier.
What are the three types of blobs? ›The storage service offers three types of blobs, block blobs, append blobs, and page blobs.