Automating Azure Data Factory and Integration Runtime Version Retrieval using PowerShell

The following steps outline a method that I use to automate the retrieval of Azure Data Factory names along with their resource groups, and subsequently, the retrieval of Integration Runtimes and their statuses, specifically their versions. This is accomplished using two PowerShell scripts executed in Azure Cloud Shell.

Step 1: Export Data Factories and Resource Groups to CSV
Retrieve all Data Factories along with their corresponding Resource Groups and export the information to a CSV file.

Script:

# Login to Azure account if not already logged in (Cloud Shell automatically logs you in)
# Connect-AzAccount 

# Get all resource groups
$resourceGroups = Get-AzResourceGroup

# Initialize an array to store the results
$dataFactoriesList = @()

# Iterate through each resource group
foreach ($rg in $resourceGroups) {
    $rgName = $rg.ResourceGroupName
    Write-Output "Processing Resource Group: $rgName"
    
    try {
        $dataFactories = Get-AzDataFactoryV2 -ResourceGroupName $rgName
        if ($dataFactories -ne $null) {
            Write-Output "Data Factories retrieved for Resource Group: $rgName - Count: $($dataFactories.Count)"
        }
    } catch {
        Write-Output "Error retrieving Data Factories for Resource Group: $rgName. Error: $_"
        continue
    }

    # Check if there are any data factories
    if ($dataFactories -eq $null -or $dataFactories.Count -eq 0) {
        Write-Output "No Data Factories found in Resource Group: $rgName"
        continue
    }

    # Iterate through each data factory
    foreach ($adf in $dataFactories) {
        Write-Output "  Data Factory Name: $($adf.DataFactoryName)"
        $dataFactoriesList += [pscustomobject]@{
            ResourceGroupName = $rgName
            DataFactoryName   = $adf.DataFactoryName
        }
    }
}

# Check the contents of $dataFactoriesList before exporting to CSV
Write-Output "Contents of dataFactoriesList:"
$dataFactoriesList | Format-Table -AutoSize

# Export the data factories list to a CSV file
$dataFactoriesList | Export-Csv -Path "$HOME/DataFactoriesList.csv" -NoTypeInformation
Write-Output "Data Factories list exported to $HOME/DataFactoriesList.csv"

Outcome:
This script produces a CSV file (DataFactoriesList.csv) containing the names of all Data Factories and their corresponding Resource Groups.

Step 2: Use CSV to Find Integration Runtimes and Their Statuses
Uses the CSV file from Step 1 to find Integration Runtimes for each Data Factory, retrieve their statuses, and specifically extract their versions.

Script:

# Import the CSV file
$dataFactoriesList = Import-Csv -Path "$HOME/DataFactoriesList.csv"

# Initialize an array to store the results
$integrationRuntimes = @()

# Iterate through each data factory in the CSV file
foreach ($entry in $dataFactoriesList) {
    $rgName = $entry.ResourceGroupName
    $adfName = $entry.DataFactoryName
    Write-Output "Processing Data Factory: $adfName in Resource Group: $rgName"

    try {
        $integrationRuntimesInADF = Get-AzDataFactoryV2IntegrationRuntime -ResourceGroupName $rgName -DataFactoryName $adfName
    } catch {
        Write-Output "Error retrieving Integration Runtimes for Data Factory: $adfName in Resource Group: $rgName. Error: $_"
        continue
    }

    # Check if there are any integration runtimes
    if ($integrationRuntimesInADF -eq $null -or $integrationRuntimesInADF.Count -eq 0) {
        Write-Output "    No Integration Runtimes found in Data Factory: $adfName"
        continue
    }

    # Iterate through each integration runtime
    foreach ($ir in $integrationRuntimesInADF) {
        $irName = $ir.Name
        Write-Output "    Processing Integration Runtime: $irName"

        try {
            $irStatus = Get-AzDataFactoryV2IntegrationRuntime -ResourceGroupName $rgName -DataFactoryName $adfName -Name $irName -Status
            Write-Output "    Status retrieved for Integration Runtime: $irName"

            # Extract the version information from the status
            $version = $irStatus.Version
        } catch {
            Write-Output "Error retrieving status for Integration Runtime: $irName in Data Factory: $adfName. Error: $_"
            continue
        }

        $integrationRuntimes += [pscustomobject]@{
            ResourceGroupName = $rgName
            DataFactoryName   = $adfName
            IntegrationRuntimeName = $irName
            Version           = $version
        }
    }
}

# Output the results
if ($integrationRuntimes.Count -gt 0) {
    $integrationRuntimes | Format-Table -AutoSize
    # Optionally, you can export the results to a CSV file
    $integrationRuntimes | Export-Csv -Path "$HOME/IntegrationRuntimesStatus.csv" -NoTypeInformation
    Write-Output "Integration Runtimes status exported to $HOME/IntegrationRuntimesStatus.csv"
} else {
    Write-Output "No Integration Runtimes found."

Outcome:
This script produces a CSV file (IntegrationRuntimesStatus.csv) containing the names of all Integration Runtimes, their respective Data Factories, Resource Groups, and their versions.

Summary:
These two PowerShell scripts automate the process of retrieving and exporting information about Azure Data Factories and their Integration Runtimes. The first script collects Data Factory names and their Resource Groups, while the second script uses this information to gather and export the statuses of Integration Runtimes, focusing on their versions. This method is useful for regularly monitoring and updating Integration Runtimes across multiple Data Factories and Resource Groups in an Azure environment.

This should be an available option in the Azure portal instead of admins trying to go to each ADF and find the versions of self-hosted IRs

New contributor

Hooman Haghighat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật