src/Get-cciModule.ps1
function Get-cciModule { [CmdletBinding()] param ( $Name, $destination = 'C:\CCI' ) begin { Write-Verbose "Started running $($MyInvocation.MyCommand)" $cciConnectionParams = Get-cciConnectionParams } process { if ($null -eq (Get-AzContext)) { Connect-cciAzAccount } if (!(Test-Path $destination\$name)) { if (!(Test-Path $destination)) { New-Item $destination -ItemType Directory } $azStorageAccount = Get-AzStorageAccount $azStorageContainers = $azStorageAccount | Get-AzStorageContainer $azStorageContainerMatches = $azStorageContainers | Where-Object Name -eq $cciConnectionParams.azStorageContainer_Name_Modules $azStorageBlob = $azStorageContainerMatches | Get-AzStorageBlob -Prefix $Name $null = $azStorageBlob | Get-AzStorageBlobContent -Destination $destination } } end { Write-Verbose "Finished running $($MyInvocation.MyCommand)" } } |