Skip to content

Commit

Permalink
[CI Environment] Machine Learning Workspaces Custom Deletion (#3400)
Browse files Browse the repository at this point in the history
* Machine Learning Workspace purge logic

* add removal sequence
  • Loading branch information
eriqua authored Jul 5, 2023
1 parent d2bb0df commit 7ca7a3b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function Initialize-DeploymentRemoval {
'Microsoft.Authorization/policySetDefinitions',
'Microsoft.Authorization/policyDefinitions'
'Microsoft.Sql/managedInstances',
'Microsoft.MachineLearningServices/workspaces',
'Microsoft.Resources/resourceGroups',
'Microsoft.Compute/virtualMachines'
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,20 @@ function Invoke-ResourceRemoval {
}
break
}
'Microsoft.MachineLearningServices/workspaces' {
$subscriptionId = $resourceId.Split('/')[2]
$resourceGroupName = $resourceId.Split('/')[4]
$resourceName = Split-Path $resourceId -Leaf
$purgePath = 'subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.MachineLearningServices/workspaces/{2}?api-version=2023-04-01-preview&forceToPurge={3}' -f $subscriptionId, $resourceGroupName, $resourceName, $true
$purgeRequestInputObject = @{
Method = 'DELETE'
Path = $purgePath
}
if ($PSCmdlet.ShouldProcess("Machine Learning Workspace [$resourceName]", 'Remove')) {
$null = Invoke-AzRestMethod @purgeRequestInputObject
}
break
}

### CODE LOCATION: Add custom removal action here
Default {
Expand Down

0 comments on commit 7ca7a3b

Please sign in to comment.