skip to Main Content

I’m trying to change the tier of a blob in storage account through ADF using Web Activity:

I am refering to this link – https://learn.microsoft.com/en-us/rest/api/storageservices/set-blob-tier?tabs=azure-ad

The required values used are as below:

URL :https://myaccount.blob.core.windows.net/mycontainer/myblob?comp=tier
(modified to my account and blob names)

ADF JSON:

{
"name": "changeTIER",
"properties": {
"activities": [
{
"name": "Web1",
"type": "WebActivity",
"dependsOn": [],
"policy": {
"timeout": "0.12:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"url": "https://myaccount.blob.core.windows.net/mycontainer/combinedOutput.json?comp=tier",
"method": "PUT",
"headers": {
"x-ms-version": "2014-02-14",
"x-ms-access-tier": "Cool",
"x-ms-date": {
"value": "@utcNow(‘dddd, dd MMM yyyy HH:mm:ss’)",
"type": "Expression"
},
"Authorization": ""
},
"body": ""tier": "Cool"",
"authentication": {
"type": "MSI",
"resource": "https://storage.azure.com/"
}
}
}
],
"annotations": [],
"lastPublishTime": "2023-04-11T05:08:13Z"
},
"type": "Microsoft.DataFactory/factories/pipelines"

I’m using the date format as this -@utcNow(‘dddd, dd MMM yyyy HH:mm:ss’) and a SAS Key along with MSI Authentication

I am getting the error:
Error calling the endpoint ‘https://myaccount.blob.core.windows.net’. Response status code: ‘NA – Unknown’. More details: Exception message: ‘NA – Unknown [ClientSideException] The format of value ”.
Request didn’t reach the server from the client. This could happen because of an underlying issue such as network connectivity, a DNS failure, a server certificate validation or a timeout.

Please help me with the right format and settings to connect and update the tier using the Web Activity in ADF-Am I missing any changes in the BLOB?

I have tried all stackoverflow articles and MS documentations.

2

Answers


  1. Chosen as BEST ANSWER

    It works with Web Activity also -only error was in format of the date header. Using this -@concat(utcNow('ddd, dd MMM yyyy HH:mm:ss'),' GMT') is working now.

    The correct format should be like this for eg -Wed, 19 Apr 2023 05:15:42 GMT


  2. Three way’s you can change the Azure Storage account tier.

    Approach 1:

    First, you can manually change the tier in the Azure storage account like this:

    enter image description here

    Approach 2.

    Use custom activity in Azure data factory run PowerShell script and change the tier.

    $StrAccount = ""
    $StrKey = ""
    $Cont1 = ""
    
    $ctx = New-AzureStorageContext -StorageAccountName $StrAccount -StorageAccountKey $StrKey
    
    # Get all the blobs in container
    $blob = Get-AzureStorageBlob -Container $Cont1 -Context $ctx
    
    # Set the tier of all the blobs.
    $blob.ICloudBlob.SetStandardBlobTier("Cool")
    

    Upload power shell file in Azure storage account and perform the custom activity in Azure data factory.
    enter image description here

    For more information refer to this link.

    Approach 3:

    Use CopyActivity, to set blob tier, and also use Header: like this

    "headers": { "x-ms-version": "2019-12-12", "x-ms-access-tier": "Cool", "x-ms-date": { "value": "@utcNow('dddd, dd MMM yyyy HH:mm:ss')", "type": "Expression" },
    

    For information refer this SO thread by KarthikBhyresh-MT

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search