Private/Get-VMMetricsBlobName.ps1
|
function Get-VMMetricsBlobName { <# .SYNOPSIS Builds the blob name (virtual path) for a VMPerformance file: {Customer}/{Date}/{FileName}. .DESCRIPTION Pure, Azure-free path builder so the layout is unit-testable. Customer names are used as-is (real names, e.g. 'WorkSafe BC'); spaces are legal in blob names. Only backslashes are normalised to forward slashes and a leading/trailing slash trimmed. .PARAMETER Customer Real customer name; first path segment. .PARAMETER Date Run date as 'yyyy-MM-dd'; second path segment. .PARAMETER FileName The leaf file name (e.g. 'VMPerformance-2026-06-11.csv'). .OUTPUTS [string] '{Customer}/{Date}/{FileName}'. #> [CmdletBinding()] [OutputType([string])] param( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $Customer, [Parameter(Mandatory)] [ValidatePattern('^\d{4}-\d{2}-\d{2}$')] [string] $Date, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $FileName ) $segments = @($Customer, $Date, $FileName) | ForEach-Object { ($_ -replace '\\', '/').Trim('/') } return ($segments -join '/') } |