Functions/Remove-DatabricksJobFromWorkspaceByName.ps1
<#
.SYNOPSIS Removes DataBricks job(s) from environment configuration .DESCRIPTION Removes DataBricks job(s) from environment configuration. .PARAMETER jobsConfig The job name(s) you want to remove The format has to be specified here: https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/jobs#--delete .EXAMPLE Remove-DatabricksJobFromWorkspaceByName -config $config -bearerToken 'dapi1234567890' -jobsConfig '<PSObject>' .NOTES Author: Sabin IO #> Function Remove-DatabricksJobFromWorkspaceByName { [cmdletbinding()] Param( [parameter(Mandatory = $true)][string]$jobName ) try { $JobId = (Get-DatabricksJobs | Where-Object { $_.settings.name -eq $jobName }).job_id if ($JobId) { Write-Verbose "Job found with this name `"$($jobName)`" - Job Id [$($JobId)]..." Remove-DatabricksJob -JobId $JobId } else { Write-Warning "No job found with name `"$($jobName)`" - skipping delete..." } } catch { throw $_.Exception } } |