Orphaned resources are unused resources present in the system and they can lead to unnecessary expenses. Citrix provides a detailed scanning functionality to identify orphaned resources present in the system offering administrators better ways for resource management. This feature helps in cost cutting and optimizes cloud efficiency by allowing the administrators to take further action on the identified orphaned resources.
Citrix recommends understanding the scenarios which generate orphaned resources before taking further action.
Possible reasons leading to orphaned resources:
If administrators lock a resource group to prevent the accidental deletion of the resources within, then operations like updating images cannot delete the temporary resources present in the group.
The following table lists the temporary resources that exists in the resource group:
Resource Name |
Resource Type |
---|---|
Citrix-Deny-All-xxx |
Network Security Group |
Preparati-xxx |
Virtual Machine |
Preparati-xxx-osdisk-xxx |
Disk |
preparati-xxx |
Network Interface |
prepare-identify-xxx |
Disk |
prepare-identify-xxx-snapshot |
Snapshot |
prepare-wbc-xxx |
Disk |
xxx-<image name>-snapshot-xxx |
Snapshot |
<virtual machine>-TemporaryStorage-xxx |
Disk |
<virtual machine>-IdentifyDisk-xxx-snapshot |
Disk |
citrixxd | Storage Account |
After identifying the orphaned resources, administrators can either proceed to delete or ignore them. Follow the below steps to perform either of the required actions.
DeleteNavigate to the Azure portal to locate the resources using their resources IDs and delete them.
Download the orphaned resources list from the Studio and run the below script.
try {
$cvsdata = Import-Csv -Path "<Your_CVS_File>"
foreach ($row in $cvsdata) {
$id = $row.id
Write-Output("Resource Id: " + $id)
Remove-AzResource -ResourceId $id
}
} catch {
Write-Output("Exception Occurred")
Write-Host $_
}
For the identified orphaned resources, set the "CitrixDetectIgnore" tag to "true" to ignore the resources in the next scanning for orphaned resources.
Navigate to the Azure portal to locate the resources using their resources IDs, then manually add tag "CitrixDetectIgnore" with value "true".
$resourceId = "<Your_Resource_ID>"
$tagName = "CitrixDetectIgnore"
$tagValue = "true"
Update-AzTag -ResourceId $resourceId -Tag @{$tagName=$tagValue} -Operation Merge
Note:
Orphaned resource detection depends on specific Citrix tags prefixed with "Citrix", such as "CitrixProvisioningSchemeId" and "CitrixResource" etc. For on-prem DDC, administrators must tag the existing provisioned resources with Citrix specific tags before detecting orphaned resources.
To tag the resources with Citrix PoSH, download the SetProvResourceTag.ps1 and execute “SetProvResourceTag.ps1 -MachineCatalogs Your_Catalog_List”. If you don’t provide a machine catalog list, the script will by default tag all the existing machine catalogs’ resources. The script will go through the provisioning database to identify resources currently managed by provisioning, then go to hypervisor to add necessary tags on each resource.