$myXml = [xml](Get-Content ./MyXml.xml)
$departmentId = $myXml.Department.Id
Write-Host "##vso[task.setvariable variable=DepartmentId;]$departmentId"
Write-Host "Set environment variable to ($env:DepartmentId)"
Get-ChildItem Env:
Write-Host "Department Id ($departmentId)"