Private/Get-specBlobModuleUrls.ps1
|
function Get-specBlobModuleUrls { <# .SYNOPSIS Constructs the URLs to download a module’s files from Azure Blob Storage. .DESCRIPTION Generates the full URLs for the .psm1 and .psd1 files for a specific module and version stored in Azure Blob Storage. .PARAMETER ModuleName The name of the module. .PARAMETER RequiredVersion The version of the module. .PARAMETER StorageAccount The Azure storage account name. .PARAMETER ContainerName The Blob Storage container name. .PARAMETER SasKey The SAS key to access the container. .OUTPUTS [ordered] hashtable with keys 'Psm1Url' and 'Psd1Url'. .EXAMPLE $urls = Get-specBlobModuleUrls -ModuleName 'MyModule' ` -RequiredVersion '1.0.0' ` -StorageAccount 'mystorage' ` -ContainerName 'modules' ` -SasKey '?sv=...' .NOTES Author: owen.heaume Version: 1.0 - Initial release #> [CmdletBinding()] param ( [Parameter(Mandatory)] [string]$ModuleName, [Parameter(Mandatory)] [string]$RequiredVersion, [Parameter(Mandatory)] [string]$StorageAccount, [Parameter(Mandatory)] [string]$ContainerName, [Parameter(Mandatory)] [string]$SasKey ) $baseUrl = "https://$StorageAccount.blob.core.windows.net/$ContainerName" $moduleDir = "$baseUrl/$ModuleName/$RequiredVersion/$ModuleName" [ordered]@{ Psm1Url = "$moduleDir/$ModuleName.psm1$SasKey" Psd1Url = "$moduleDir/$ModuleName.psd1$SasKey" } } |