Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CI/CD

on:
push:
branches: ['**']
pull_request:
workflow_dispatch:

permissions:
contents: read
checks: write # required by dorny/test-reporter

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Run Unit Tests
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Login via Az module
uses: azure/login@v3
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
enable-AzPSSession: true

- name: Run Unit Tests
uses: azure/powershell@v3
with:
inlineScript: |
test/!RunAllTests.ps1 -folder '${{ github.workspace }}/' -TestFilenameFilter "*" -InstallModules:$false -ResultOutputFormat "JUnitXml"
azPSVersion: "latest"

- name: Publish Test Results
uses: dorny/test-reporter@v3
if: ${{ !cancelled() }}
with:
name: Pester Tests
path: '**/TEST-*.xml'
reporter: java-junit
collapsed: 'auto'

publish:
name: Publish to PS Gallery
runs-on: windows-latest
needs: test
if: ${{ github.event_name != 'pull_request' && (github.ref_name == 'master' || github.ref_name == 'develop') }}

steps:
- uses: actions/checkout@v4

- name: Publish module to PowerShell Gallery
shell: pwsh
env:
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }}
run: |
$isPreview = '${{ github.ref_name }}' -ne 'master'
Write-Host "Branch: ${{ github.ref_name }} | Preview: $isPreview"
./tools/Publish-ToGallery.ps1 -IsPreview:$isPreview -NuGetApiKey $env:PSGALLERY_API_KEY
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* Further fixes of `DeleteNotInSource` with deserialization issue #480
* `Publish-AdfV2FromJson` no longer silently continues after errors: config path errors (ADFT0010) and deployment failures (e.g. Azure Policy blocks) now propagate as terminating errors to the caller #472

## [1.16.0] - 2026-05-27
## [1.16.0] - 2026-06-06
### Fixed
* `DeleteNotInSource` no longer fails with "Unable to deserialize the response" when ADF contains object types unsupported by the installed Az.DataFactory module version - REST API fallback added to `Get-AdfFromService` #480 #473
* Fixed ClientAssertionCredential authentication failure for federated identity (OIDC) credentials by removing redundant `Get-AzAccessToken` calls in `Get-AzDFV2Credential` and `Remove-AdfObjectRestAPI` #492

## [1.15.0] - 2026-05-26
### Added
Expand Down
7 changes: 0 additions & 7 deletions private/Get-AzDFV2Credential.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ function Get-AzDFV2Credential {
)
Write-Debug "BEGIN: Get-AzDFV2Credential"

# Retrieve all credentials via API without parsing
$token = Get-AzAccessToken -ResourceUrl 'https://management.azure.com'
$tokenStr = [System.Net.NetworkCredential]::new('', $token.Token).Password
$authHeader = @{
'Content-Type' = 'application/json'
'Authorization' = 'Bearer ' + $tokenStr
}
$url = "$($script:BaseApiUrl)$($adfi.DataFactoryId)/credentials?api-version=2018-06-01"

# Retrieve all credentials via Rest API
Expand Down
8 changes: 1 addition & 7 deletions private/Remove-AdfObjectRestAPI.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,10 @@ function Remove-AdfObjectRestAPI {

Write-Debug "BEGIN: Remove-AdfObjectRestAPI()"

$token = Get-AzAccessToken -ResourceUrl 'https://management.azure.com'
$tokenStr = [System.Net.NetworkCredential]::new('', $token.Token).Password
$authHeader = @{
'Content-Type' = 'application/json'
'Authorization' = 'Bearer ' + $tokenStr
}
$url = "$($script:BaseApiUrl)$($adfInstance.Id)/$type_plural/$($name)?api-version=2018-06-01"

# Delete given object via Rest API
$r = Invoke-AzRestMethod -Method 'DELETE' -Uri $url #-Headers $authHeader -ContentType "application/json"
$r = Invoke-AzRestMethod -Method 'DELETE' -Uri $url
if ($r.StatusCode -ne 200) {
Write-Error -Message "Unexpected response code: $($r.StatusCode) from the API."
}
Expand Down
14 changes: 0 additions & 14 deletions test/Get-AzDFV2Credential.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ InModuleScope azure.datafactory.tools {
BeforeEach {
$script:adfi = [PSCustomObject]@{ DataFactoryId = '/subscriptions/sub-123/resourceGroups/rg/providers/Microsoft.DataFactory/factories/adf1' }

Mock Get-AzAccessToken {
return [PSCustomObject]@{ Token = 'fake-token-abc' }
}
Mock Invoke-AzRestMethod {
return [PSCustomObject]@{ StatusCode = 200; Content = '{"value":[]}' }
}
Expand All @@ -33,11 +30,6 @@ InModuleScope azure.datafactory.tools {
@($result).Count | Should -Be 0
}

It 'Should call Get-AzAccessToken once' {
Get-AzDFV2Credential -adfi $script:adfi
Assert-MockCalled Get-AzAccessToken -Times 1 -Exactly
}

It 'Should call Invoke-AzRestMethod once' {
Get-AzDFV2Credential -adfi $script:adfi
Assert-MockCalled Invoke-AzRestMethod -Times 1 -Exactly
Expand Down Expand Up @@ -66,9 +58,6 @@ InModuleScope azure.datafactory.tools {
$cred2 = [PSCustomObject]@{ name = 'cred2'; type = 'Microsoft.DataFactory/factories/credentials'; properties = @{} }
$script:credJson = @{ value = @($cred1, $cred2) } | ConvertTo-Json -Depth 5

Mock Get-AzAccessToken {
return [PSCustomObject]@{ Token = 'fake-token-abc' }
}
Mock Invoke-AzRestMethod {
return [PSCustomObject]@{ StatusCode = 200; Content = $script:credJson }
}
Expand Down Expand Up @@ -97,9 +86,6 @@ InModuleScope azure.datafactory.tools {
BeforeEach {
$script:adfi = [PSCustomObject]@{ DataFactoryId = '/subscriptions/sub-123/resourceGroups/rg/providers/Microsoft.DataFactory/factories/adf1' }

Mock Get-AzAccessToken {
return [PSCustomObject]@{ Token = 'fake-token-abc' }
}
Mock Invoke-AzRestMethod { throw 'Unauthorized' }
}

Expand Down
Loading