MetadataInfo/GetMetadataInfo.ps1
Set-StrictMode -Version Latest function Get-AzSDKInfo { <# .SYNOPSIS This command would help in setting up the all the critical subscription security packages .DESCRIPTION This command would help in setting up the all the critical subscription security packages .LINK https://aka.ms/azsdkossdocs #> Param( [Parameter(Mandatory = $false)] [ValidateSet("BasicInfo", "ControlInfo", "EnvironmentInfo" , "AttestationInfo")] $InfoType = [InfoType]::BasicInfo, [string] $ResourceTypeName = [ResourceTypeName]::All, [string] $ResourceType, [string] $ControlIds, [switch] $UseBaselineControls, [string] $FilterTags, [string] $SubscriptionId, [string] $ResourceGroupNames, [string] [Alias("ResourceName")] $ResourceNames, [switch] $DoNotOpenOutputFolder ) Begin { [CommandHelper]::BeginCommand($PSCmdlet.MyInvocation); [ListenerHelper]::RegisterListeners(); } Process { try { if ([string]::IsNullOrEmpty($SubscriptionId)) { if($InfoType.ToString() -eq 'AttestationInfo') { $SubscriptionId = Read-Host "SubscriptionId" $SubscriptionId = $SubscriptionId.Trim() } else { $SubscriptionId = [Constants]::BlankSubscriptionId } } switch ($InfoType.ToString()) { BasicInfo { $basicInfo = [BasicInfo]::new($SubscriptionId, $PSCmdlet.MyInvocation); if ($basicInfo) { return $basicInfo.InvokeFunction($basicInfo.GetBasicInfo); } } ControlInfo { $controlsInfo = [ControlsInfo]::new($SubscriptionId, $PSCmdlet.MyInvocation, $ResourceTypeName, $ResourceType, $ControlIds, $UseBaselineControls, $FilterTags); if ($controlsInfo) { return $controlsInfo.InvokeFunction($controlsInfo.GetControlDetails); } } EnvironmentInfo { $environmentInfo = [EnvironmentInfo]::new($SubscriptionId, $PSCmdlet.MyInvocation); if ($environmentInfo) { return $environmentInfo.InvokeFunction($environmentInfo.GetEnvironmentInfo); } } AttestationInfo { $resolver = [SVTResourceResolver]::new($SubscriptionId, $ResourceGroupNames, $ResourceNames, $ResourceType, $ResourceTypeName); $attestationReport = [SVTStatusReport]::new($SubscriptionId, $PSCmdlet.MyInvocation, $resolver); if ($attestationReport) { $attestationReport.ControlIdString = $ControlIds; [AttestationOptions] $attestationOptions = [AttestationOptions]::new(); #$attestationOptions.AttestationStatus = $AttestationStatus $attestationReport.AttestationOptions = $attestationOptions; return ([CommandBase]$attestationReport).InvokeFunction($attestationReport.FetchAttestationInfo); } } } } catch { [EventBase]::PublishGenericException($_); } } End { [ListenerHelper]::UnregisterListeners(); } } |