Functions/Remove-DatabricksJobsFromConfig.ps1
<#
.SYNOPSIS Remove DataBricks job(s) that is present in the config file from a workspace. .DESCRIPTION Remove DataBricks job(s) that is present in the config file from a workspace. .PARAMETER config Configuration json file from the environment used to workout whether to remove a job from a workspace. .PARAMETER bearerToken Your Databricks Bearer token to authenticate to your workspace (see User Settings in Datatbricks WebUI) .EXAMPLE Remove-DatabricksJobsFromConfig -config $config -bearerToken 'dapi1234567890' .NOTES Author: Sabin IO #> Function Remove-DatabricksJobsFromConfig { [cmdletbinding()] Param( [parameter(Mandatory = $true)]$config, [parameter(Mandatory = $true)][string]$bearerToken ) try { if (($config.removeJobsByName) -and ($config.removeJobsByName.Length -ge 1)) { Write-Output "[Removing] job(s) listed in config" foreach ($jobName in $config.removeJobsByName) { Remove-DatabricksJobFromWorkspaceByName -config $config ` -bearerToken $bearerToken ` -jobName $jobName } } } catch { #uh oh throw $_.Exception } } |