PolicySetup/PolicySetup.ps1
Set-StrictMode -Version Latest function Install-AzSKOrganizationPolicy { <# .SYNOPSIS This command is intended to be used by central Organization team to setup Organization specific policies .DESCRIPTION This command is intended to be used by central Organization team to setup Organization specific policies #> [OutputType([String])] Param ( [string] [Parameter(Mandatory = $true, Position = 0)] [ValidateNotNullOrEmpty()] $SubscriptionId, #[Parameter(Mandatory = $false)] #[string] #$ResourceGroupName, [Parameter(Mandatory = $false)] [string] $ResourceGroupLocation = "EastUS2", [Parameter(Mandatory = $true)] [string] $OrgName, [Parameter(Mandatory = $false)] [string] $DepartmentName, [Parameter(Mandatory = $false)] [string] $PolicyFolderPath ) Begin { [CommandHelper]::BeginCommand($PSCmdlet.MyInvocation); [ListenerHelper]::RegisterListeners(); } Process { try { $policy = [PolicySetup]::new($SubscriptionId, $PSCmdlet.MyInvocation, $OrgName, $DepartmentName, $ResourceGroupLocation, $PolicyFolderPath); if ($policy) { return $policy.InvokeFunction($policy.InstallPolicy); } } catch { [EventBase]::PublishGenericException($_); } } End { [ListenerHelper]::UnregisterListeners(); } } |