MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.29k stars 21.47k forks source link

Failing to create authentication headers while creating Rest linked service through PowerShell script #124850

Open AmareswarapuBhavani opened 3 days ago

AmareswarapuBhavani commented 3 days ago

Document Correction Proposal: When creating a REST linked service in ADF, authHeadersmay not persist in the linked service configuration.

Overview:

When creating a REST linked service in ADF, authHeaders may not persist in the linked service configuration. This issue occurs despite defining the headers with SecureString in both the JSON template and PowerShell script as recommended.

Sample JSON Template:

The JSON configuration for creating a REST linked service is as follows:

{
    "properties": {
        "type": "RestService",
        "typeProperties": {
            "url": "https://url.com",
            "enableServerCertificateValidation": true,
            "authenticationType": "Anonymous",
            "authHeaders": {
                "x-api-key": {
                    "type": "SecureString",
                    "value": "<API key>"
                }
            }
        }
    }
}

PowerShell Command Used:

Set-AzDataFactoryV2LinkedService -ResourceGroupName "<resourceGroupName>" -DataFactoryName "<ADFName>" -Name "<linkedServiceName>" -DefinitionFile <jsonFileName>

Observed Issue:

Upon successful execution, the linked service is created, but authHeaders are not visible in the linked service configuration. If manually added, the headers disappear after refreshing the Data Factory studio, potentially impacting authentication.

Correction Details:

Headers are created but have been encrypted so they cannot be listed in UI. As long as you have provided the right value, this linked service should work well (test connection, copy, etc.)

Conclusion:

Following this guide will help users resolve issues with missing headers in REST linked services in Azure Data Factory and allow headers to persist securely and effectively. This approach enhances user experience by ensuring the accuracy and reliability of sensitive configurations in ADF.

Reference:

https://stackoverflow.com/questions/79091839/definition-file-for-a-an-azdatafactoryv2linkedservice/79097542#79097542

This proposal seeks to improve documentation and provide clear guidance to avoid common pitfalls in using secure headers with Azure Data Factory REST linked services.

TPavanBalaji commented 2 days ago

@AmareswarapuBhavani It would be great if you could add a link to the documentation you are following for these steps? This would help us redirect the issue to the appropriate team. Thanks!