Resolving ADF Pipeline Errors: “Client Address Not Authorized” by Whitelisting IP Addresses for Azure Key Vault

When working with Azure Data Factory (ADF) pipelines, secure communication between various Azure services is crucial, especially when accessing sensitive data stored in resources like Azure Key Vault. Recently, while executing an ADF pipeline, I encountered the following error message:

Operation on target Web URLToken TenantId failed: {“error”:{“code”:”Forbidden”,”message”:”Client address is not authorized and caller is not a trusted service.\r\nClient address: xx.xx.xx.xxx\r\nCaller: appid=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx;oid=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx;providers/Microsoft.DataFactory/factories/datafactoryjb;abc_er_sde=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/jb_ADF_RG/providers/Microsoft.DataFactory/factories/datafactoryjb\r\nVault: jbkeyvault;location=northeurope”,”innererror”:{“code”:”ForbiddenByFirewall”}}}

This error indicates that the client address attempting to access the Azure Key Vault was not authorized, preventing the pipeline from retrieving necessary secrets stored in the vault. The root cause of this issue was that the Azure Key Vault had strict network security settings that only allowed authorized IP addresses to access it. The ADF instance running in the North Europe region was not on the list of authorized addresses, causing the connection to be blocked.

In this blog post, I will walk you through how I resolved the issue by whitelisting the required IP addresses for Data Factory and ensuring secure communication between Azure Data Factory and Azure Key Vault.

Understanding the Error: Client Address Not Authorized

The error message received during the pipeline execution highlights two key aspects:

  • Client Address Not Authorized: The IP address attempting to connect to the Key Vault (ADF service in this case) was not whitelisted, which led to the request being blocked by the Key Vault’s firewall.
  • Forbidden by Firewall: The error code ForbiddenByFirewall suggests that the Key Vault is configured with firewall rules that only allow specific IP addresses to access it.

By default, Azure Key Vault can restrict access to its secrets by using firewall settings to specify which IP ranges or services are allowed to connect. This provides an extra layer of security, but in this case, it became an obstacle because the IP addresses associated with the ADF instance were not permitted.

Steps to Resolve the Issue

To resolve this issue, I followed these steps to add the necessary IP addresses to the Azure Key Vault’s firewall settings:

1. Identify the Region of the Azure Data Factory

The first step was to identify the region in which my Azure Data Factory instance was running. In this case, the ADF instance was running in the North Europe region, as seen from the error message and confirmed in the Azure portal.

2. Retrieve the IP Address Range for ADF in North Europe

Azure services like Data Factory operate from a specific set of IP ranges depending on the region they are deployed in. Microsoft publishes the IP address ranges for each service and region, which are updated periodically. You can download the full list of IP ranges for different Azure services and regions from this Microsoft link.

In this case, the required IP addresses for Data Factory in the North Europe region were as follows:

{
  "name": "DataFactory.NorthEurope",
  "id": "DataFactory.NorthEurope",
  "properties": {
    "changeNumber": 7,
    "region": "northeurope",
    "regionId": 17,
    "platform": "Azure",
    "systemService": "DataFactory",
    "addressPrefixes": [
      "4.207.242.72/29",
      "13.69.230.96/28",
      "13.74.108.224/28",
      "20.38.80.192/26",
      "20.38.82.0/23",
      "20.50.68.56/29",
      "20.223.64.60/32",
      "20.223.65.144/29",
      "48.209.130.96/28",
      "48.209.130.112/29",
      "52.138.229.32/28"
    ]
  }
}

You can get the details from Download Azure IP Ranges and Service Tags – Public Cloud from Official Microsoft Download Center.

These IP addresses need to be whitelisted in the Azure Key Vault to allow ADF to access the secrets.

3. Whitelist the IP Addresses in Azure Key Vault

To whitelist the necessary IP ranges, follow these steps:

  1. Navigate to the Azure Key Vault in the Azure portal.
  2. Select Networking from the left-side menu.
  3. Under Firewalls and virtual networks, ensure that you have selected to allow access from selected networks.
  4. Add the necessary IP address ranges to the firewall rules:
    • “4.207.242.72/29”
    • “13.69.230.96/28”
    • “13.74.108.224/28”
    • “20.38.80.192/26”
    • “20.38.82.0/23”
    • “20.50.68.56/29”
    • “20.223.64.60/32”
    • “20.223.65.144/29”
    • “48.209.130.96/28”
    • “48.209.130.112/29”
    • “52.138.229.32/28”
  5. Once the IP addresses are added, save the changes to apply the updated firewall rules.

4. Validate the Pipeline Run

After whitelisting the required IP addresses in the Key Vault, I re-ran the Azure Data Factory pipeline. This time, the pipeline successfully connected to the Key Vault and retrieved the required secrets, and the entire workflow executed without any issues.


Conclusion

The error "Client address is not authorized" occurred because the Azure Key Vault was configured with strict firewall rules, preventing Azure Data Factory from accessing it. By identifying the region of the ADF instance and retrieving the correct IP ranges for that region, I was able to whitelist the necessary addresses and resolve the issue.

This process highlights the importance of maintaining secure communication between Azure services, and how careful configuration of firewall rules can help both secure and enable workflows. Always ensure that the IP ranges for the services you are using are updated and whitelisted in sensitive resources like Azure Key Vault to prevent any disruptions in your pipelines.


Additional Resources:

Regards;
Vivek Janakiraman

Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.

SQL Server 2022 Hybrid Cloud Scenarios: A Comprehensive Guide

🌥️The ever-evolving digital landscape has prompted businesses to seek versatile and scalable IT solutions. Hybrid cloud strategies have emerged as a key approach, combining the best of on-premises and cloud environments. SQL Server 2022, with its advanced features and seamless integration with Azure, is at the forefront of enabling these hybrid cloud scenarios. This blog delves deep into the intricacies of hybrid cloud strategies with SQL Server 2022, highlighting its capabilities, benefits, and a detailed business use case to demonstrate its practical applications.🌥️


🚀 Understanding Hybrid Cloud Strategies

A hybrid cloud strategy integrates private and public cloud services with on-premises infrastructure, creating a unified, flexible computing environment. This approach allows organizations to leverage the scalability and efficiency of the cloud while maintaining control over sensitive data and critical systems. Key components of hybrid cloud strategies include:

  1. Workload Distribution: Deciding which workloads to run on-premises versus in the cloud based on factors like cost, performance, security, and compliance.
  2. Data Integration and Management: Ensuring data consistency and availability across diverse environments.
  3. Security and Compliance: Implementing robust security measures and ensuring adherence to regulatory requirements across all environments.
  4. Operational Efficiency: Streamlining IT operations through unified management and automation tools.

🌐 SQL Server 2022: A Catalyst for Hybrid Cloud Integration

SQL Server 2022 introduces several features specifically designed to support hybrid cloud environments. These features facilitate seamless integration with Azure, allowing organizations to manage data and applications across on-premises and cloud environments effortlessly.

1. Azure Arc Integration: Unified Management Across Environments

Azure Arc extends Azure’s management capabilities to on-premises, multi-cloud, and edge environments. SQL Server 2022’s integration with Azure Arc enables centralized management and governance of SQL Server instances across various environments. This capability is crucial for organizations looking to maintain consistency in policies, security, and compliance.

Key Features:

  • Centralized Monitoring: Monitor the performance, health, and security of SQL Server instances from a single dashboard.
  • Policy Enforcement: Apply consistent policies across all SQL Server instances, ensuring compliance with industry regulations.
  • Scalability: Scale SQL Server resources seamlessly, leveraging Azure’s elasticity.

2. Azure Hybrid Benefit: Cost Optimization and Flexibility

The Azure Hybrid Benefit is a valuable offering for organizations with existing SQL Server licenses. It allows these licenses to be used in Azure at a reduced cost, providing significant savings on Azure SQL Database, Azure SQL Managed Instance, and SQL Server on Azure Virtual Machines.

Key Benefits:

  • Cost Savings: Utilize existing SQL Server licenses to reduce costs in Azure.
  • Investment Protection: Leverage existing investments in SQL Server while transitioning to the cloud.
  • Flexibility: Easily move workloads between on-premises and Azure environments without additional licensing costs.

3. Azure SQL Managed Instance: Fully Managed, Highly Compatible

Azure SQL Managed Instance provides a fully managed database service with the broadest SQL Server engine compatibility. It is designed to support lifting and shifting on-premises SQL Server databases to Azure with minimal changes, making it an ideal choice for hybrid cloud strategies.

Key Features:

  • Full SQL Server Compatibility: Supports SQL Server features like SQL Agent, Database Mail, and linked servers, ensuring seamless migration.
  • Managed Service: Offloads database management tasks, including patching, backups, and monitoring, to Azure.
  • Built-in High Availability: Offers automatic backups, point-in-time restore, and high availability options, ensuring data reliability.

4. Data Synchronization and Replication: Ensuring Data Consistency

SQL Server 2022 supports various data synchronization and replication methods, critical for maintaining data consistency across hybrid environments. These include Always On Availability Groups, transactional replication, and Azure Data Sync.

Key Features:

  • Always On Availability Groups: Provides high availability and disaster recovery solutions for critical databases, with support for up to five synchronous replicas in Azure.
  • Transactional Replication: Allows data to be replicated across SQL Server instances, ensuring consistency in read-intensive applications.
  • Azure Data Sync: Synchronizes data between Azure SQL Database and on-premises SQL Server databases, supporting bi-directional synchronization.

💼 Business Use Case: Modernizing an E-commerce Retailer

Company Profile

An e-commerce retailer, specializing in electronics, operates a mix of legacy systems for inventory management, customer data, and order processing. As the company grows, it seeks to modernize its IT infrastructure by adopting a hybrid cloud strategy. The goal is to enhance scalability, improve performance, and maintain robust security while optimizing costs.

Challenges

  1. Legacy Systems: The retailer relies on aging hardware and outdated software, leading to high maintenance costs and suboptimal performance.
  2. Data Security and Compliance: Handling sensitive customer data requires strict adherence to regulations like GDPR and PCI DSS.
  3. Scalability Needs: The retailer experiences seasonal spikes in demand, necessitating a scalable infrastructure that can handle peak loads.

Solution: SQL Server 2022 and Azure Integration

The retailer adopted a hybrid cloud strategy using SQL Server 2022 and Azure, focusing on cost optimization, data security, and scalability.

Key Implementations:

  1. Centralized Management with Azure Arc: The retailer used Azure Arc to manage SQL Server instances across on-premises and cloud environments. This centralized management approach streamlined operations, allowing the IT team to enforce consistent security policies and monitor performance.
  2. Cost Optimization with Azure Hybrid Benefit: The retailer transitioned its on-premises SQL Server databases to Azure SQL Managed Instance, taking advantage of the Azure Hybrid Benefit. This move reduced overall licensing costs and enabled the retailer to leverage Azure’s managed services for improved efficiency.
  3. Seamless Migration to Azure SQL Managed Instance: The migration of critical systems, including inventory management and order processing, to Azure SQL Managed Instance was executed with minimal downtime. The retailer benefited from the managed infrastructure, automatic updates, and built-in high availability features of Azure SQL Managed Instance.
  4. Data Synchronization for Enhanced Customer Experience: The retailer implemented Always On Availability Groups to ensure data consistency across on-premises and cloud environments. This setup allowed real-time synchronization of customer and inventory data, providing a seamless shopping experience during peak periods.

Benefits Realized

  • Cost Efficiency: By utilizing the Azure Hybrid Benefit, the retailer significantly reduced licensing costs and operational expenses related to hardware maintenance.
  • Enhanced Security and Compliance: Azure’s security features and compliance certifications provided robust protection for sensitive customer data, ensuring compliance with GDPR and PCI DSS.
  • Scalability and Performance: The hybrid cloud setup allowed the retailer to scale resources dynamically during peak shopping periods, ensuring optimal performance and customer satisfaction.
  • Improved Business Continuity: The implementation of Always On Availability Groups provided a robust disaster recovery solution, minimizing the risk of data loss and downtime.

📊 Practical Examples and Implementations

Example 1: Implementing Centralized Management with Azure Arc

The retailer utilized Azure Arc to manage SQL Server instances, ensuring consistent policy enforcement and monitoring across on-premises and cloud environments.

# Example: Onboarding SQL Server to Azure Arc
az connectedmachine connect --resource-group RetailerResourceGroup --location eastus --machine-name RetailerSQLServer

Example 2: Migrating to Azure SQL Managed Instance

The migration process involved backing up on-premises databases and restoring them in Azure SQL Managed Instance.

# Example: Preparing for Migration
BACKUP DATABASE InventoryDB TO DISK = 'C:\Backup\InventoryDB.bak'
RESTORE DATABASE InventoryDB FROM DISK = 'C:\Backup\InventoryDB.bak' 
WITH MOVE 'InventoryDB_data' TO 'D:\Data\InventoryDB.mdf', 
MOVE 'InventoryDB_log' TO 'D:\Log\InventoryDB.ldf'

Example 3: Setting Up Always On Availability Groups

The retailer implemented Always On Availability Groups to synchronize data across environments, ensuring high availability and data consistency.

# Example: Configuring Always On Availability Group
CREATE AVAILABILITY GROUP [RetailerAG] 
   FOR DATABASE [InventoryDB]
   REPLICA ON 'OnPremSQLServer' WITH
      (ROLE = PRIMARY, 
       ENDPOINT_URL = 'TCP://OnPremSQLServer.retailer.com:5022', 
       AVAILABILITY_MODE = SYNCHRONOUS_COMMIT,
       FAILOVER_MODE = AUTOMATIC),
      'AzureSQLServer' WITH
      (ROLE = SECONDARY, 
       ENDPOINT_URL = 'TCP://AzureSQLServer.retailer.com:5022', 
       AVAILABILITY_MODE = SYNCHRONOUS_COMMIT,
       FAILOVER_MODE = AUTOMATIC);

🌟 Conclusion

SQL Server 2022’s robust capabilities and seamless integration with Azure provide a powerful foundation for hybrid cloud strategies. Whether managing data across on-premises and cloud environments, optimizing costs with the Azure Hybrid Benefit, or leveraging Azure SQL Managed Instance for managed services, SQL Server 2022 offers comprehensive solutions for modern businesses.

For the e-commerce retailer in our use case, adopting a hybrid cloud strategy with SQL Server 2022 and Azure enabled significant cost savings, enhanced security, improved scalability, and ensured business continuity. This approach allowed the retailer to meet the demands of a growing customer base while maintaining a secure and efficient IT infrastructure.

As organizations continue to navigate the complexities of digital transformation, SQL Server 2022 offers the tools and capabilities to succeed in a hybrid cloud environment. Embrace the future of data management with SQL Server 2022 and hybrid cloud solutions! 🌐🚀

For more tutorials and tips on SQL Server, including performance tuning and database management, be sure to check out our JBSWiki YouTube channel.

Thank You,
Vivek Janakiraman

Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.