diff --git a/.work/Debug.ps1 b/.work/Debug.ps1 deleted file mode 100644 index bde1bf4c..00000000 --- a/.work/Debug.ps1 +++ /dev/null @@ -1,2 +0,0 @@ -$env:azureClientSecret = '' -$env:azureClientId = '' diff --git a/.work/GetComplianceState.ps1 b/.work/GetComplianceState.ps1 deleted file mode 100644 index df7387b5..00000000 --- a/.work/GetComplianceState.ps1 +++ /dev/null @@ -1,14 +0,0 @@ -#Get-AzPolicyAssignment -Scope $resourceGroup.ResourceId -$subscriptionId = 'da78bd51-11ab-418d-8222-db661c2aa8d9' -$resourceGroupName = 'GCLab1' -$machineName = 'DSCFile03' - -$uri = "https://management.azure.com/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Compute/virtualMachines/$machineName/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments?api-version=2022-01-25" - -Invoke-AzRestMethod -Method GET -Uri $uri | Select-Object -ExpandProperty content | ConvertFrom-Json | - Select-Object -ExpandProperty value | - Format-Table Name, - @{ Name = 'AssignmentType'; Expression = { $PSItem.properties.guestConfiguration.assignmentType } }, - @{ Name = 'LastComplianceStatusChecked'; Expression = { $PSItem.properties.lastComplianceStatusChecked } }, - @{ Name = 'ComplianceStatus'; Expression = { $PSItem.properties.complianceStatus } }, - @{ Name = 'Version'; Expression = { $PSItem.properties.guestConfiguration.version } } diff --git a/.work/cleanup.ps1 b/.work/cleanup.ps1 deleted file mode 100644 index 63a0ea7e..00000000 --- a/.work/cleanup.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -Get-AzVM -ResourceGroupName GCLab1 | ForEach-Object { - Get-AzPolicyAssignment -Scope $_.Id | Remove-AzPolicyAssignment -} - -Get-AzPolicyDefinition | Where-Object Name -like dsc* | Remove-AzPolicyDefinition -Force diff --git a/Lab Guest Configuration/10 Azure Guest Configuration Lab.ps1 b/Lab Guest Configuration/10 Azure Guest Configuration Lab.ps1 index 16f5b5bf..86dee94b 100644 --- a/Lab Guest Configuration/10 Azure Guest Configuration Lab.ps1 +++ b/Lab Guest Configuration/10 Azure Guest Configuration Lab.ps1 @@ -1,3 +1,23 @@ +<# +.SYNOPSIS +This script creates a lab environment for the Azure Guest Configuration lab. + +.PARAMETER LocationName +Specifies the location where the lab environment will be created. Default is 'West Europe'. + +.PARAMETER SubscriptionName +Specifies the name of the Azure subscription to use. + +.NOTES +This script requires the Azure PowerShell module to be installed. + +.EXAMPLE +.\10 Azure Guest Configuration Lab.ps1 -LocationName 'East US' -SubscriptionName 'MySubscription' + +This example creates a lab environment in the 'East US' location using the 'MySubscription' Azure subscription. + +#> + param ( [Parameter()] diff --git a/Lab Guest Configuration/20 Azure Guest Configuration Lab Customizations.ps1 b/Lab Guest Configuration/20 Azure Guest Configuration Lab Customizations.ps1 index 4ec9f3cd..755ef02a 100644 --- a/Lab Guest Configuration/20 Azure Guest Configuration Lab Customizations.ps1 +++ b/Lab Guest Configuration/20 Azure Guest Configuration Lab Customizations.ps1 @@ -1,5 +1,19 @@ #Requires -Modules AutomatedLab, Az.Resources, Az.ManagedServiceIdentity +<# +.SYNOPSIS +This script customizes the Azure Guest Configuration lab environment. + +.NOTES +This script requires the AutomatedLab, Az.Resources, and Az.ManagedServiceIdentity PowerShell modules to be installed. + +.EXAMPLE +.\20 Azure Guest Configuration Lab Customizations.ps1 + +This example customizes the Azure Guest Configuration lab environment. + +#> + if (-not $lab) { $lab = Import-Lab -Name GCLab1 -NoValidation -PassThru diff --git a/Lab Guest Configuration/99 Get-MachineComplianceState.ps1 b/Lab Guest Configuration/99 Get-MachineComplianceState.ps1 new file mode 100644 index 00000000..9d1670d9 --- /dev/null +++ b/Lab Guest Configuration/99 Get-MachineComplianceState.ps1 @@ -0,0 +1,26 @@ +#Get-AzPolicyAssignment -Scope $resourceGroup.ResourceId +$subscriptionId = '' +$resourceGroupName = '' +$machineName = '' + +$uri = "https://management.azure.com/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Compute/virtualMachines/$machineName/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments?api-version=2022-01-25" + +Invoke-AzRestMethod -Method GET -Uri $uri | Select-Object -ExpandProperty content | ConvertFrom-Json | + Select-Object -ExpandProperty value | + Format-Table Name, + @{ + Name = 'AssignmentType' + Expression = { $PSItem.properties.guestConfiguration.assignmentType } + }, + @{ + Name = 'LastComplianceStatusChecked' + Expression = { $PSItem.properties.lastComplianceStatusChecked } + }, + @{ + Name = 'ComplianceStatus' + Expression = { $PSItem.properties.complianceStatus } + }, + @{ + Name = 'Version' + Expression = { $PSItem.properties.guestConfiguration.version } + } diff --git a/source/GCPackages/UserAmyNotPresent/UserAmyNotPresent.config.ps1 b/source/GCPackages/UserAmyNotPresent/UserAmyNotPresent.config.ps1 deleted file mode 100644 index 20cc92be..00000000 --- a/source/GCPackages/UserAmyNotPresent/UserAmyNotPresent.config.ps1 +++ /dev/null @@ -1,12 +0,0 @@ -Configuration UserAmyNotPresent { - Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' - - Node UserAmyNotPresent - { - xUser 'UserAmyNotPresent' - { - Ensure = 'Absent' - UserName = 'amy' - } - } -} diff --git a/source/GCPackages/UserAmyPresent/UserAmyPresent.config.ps1 b/source/GCPackages/UserAmyPresent/UserAmyPresent.config.ps1 deleted file mode 100644 index c7ef5685..00000000 --- a/source/GCPackages/UserAmyPresent/UserAmyPresent.config.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -Configuration UserAmyPresent { - Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' - - $cred = New-Object System.Management.Automation.PSCredential('amy', (ConvertTo-SecureString -String 'Somepass1' -AsPlainText -Force)) - - Node UserAmyPresent - { - xUser 'UserAmyPresent' - { - Ensure = 'Present' - UserName = 'amy' - Password = $cred - } - } -} diff --git a/source/_TestRsopReferences/ReferenceConfigurationDev.yml b/source/TestRsopReferences/ReferenceConfigurationDev.yml similarity index 100% rename from source/_TestRsopReferences/ReferenceConfigurationDev.yml rename to source/TestRsopReferences/ReferenceConfigurationDev.yml diff --git a/source/_TestRsopReferences/ReferenceConfigurationProd.yml b/source/TestRsopReferences/ReferenceConfigurationProd.yml similarity index 100% rename from source/_TestRsopReferences/ReferenceConfigurationProd.yml rename to source/TestRsopReferences/ReferenceConfigurationProd.yml diff --git a/source/_TestRsopReferences/ReferenceConfigurationTest.yml b/source/TestRsopReferences/ReferenceConfigurationTest.yml similarity index 100% rename from source/_TestRsopReferences/ReferenceConfigurationTest.yml rename to source/TestRsopReferences/ReferenceConfigurationTest.yml