Skip to content

Commit

Permalink
Move Resources to main (Azure#27044)
Browse files Browse the repository at this point in the history
  • Loading branch information
azure-powershell-bot authored Jan 24, 2025
1 parent dcb0edd commit 6031f0f
Show file tree
Hide file tree
Showing 246 changed files with 4,176 additions and 1,091 deletions.
2 changes: 1 addition & 1 deletion src/Resources/Authorization.Autorest/Az.Authorization.psd1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@{
GUID = '7f96e662-b170-4f95-899f-bbd1828cd20b'
GUID = '5e804a75-47b7-4aac-9e3b-4bbc49a1abca'
RootModule = './Az.Authorization.psm1'
ModuleVersion = '0.1.0'
CompatiblePSEditions = 'Core', 'Desktop'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Module Name: Az.Authorization
Module Guid: 7f96e662-b170-4f95-899f-bbd1828cd20b
Module Guid: 5e804a75-47b7-4aac-9e3b-4bbc49a1abca
Download Help Link: https://learn.microsoft.com/powershell/module/az.authorization
Help Version: 1.0.0.0
Locale: en-US
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ The second command gets the policy exemption named PolicyExemption07 for the sco

### Example 3: Get all policy exemptions associated with a policy assignment
```powershell
$Assignment = Get-AzPolicyAssignment -Name 'PolicyAssignment07'
Get-AzPolicyExemption -PolicyAssignmentIdFilter $Assignment.ResourceId
$ResourceGroup = Get-AzResourceGroup -Name 'ResourceGroup11'
$Assignment = Get-AzPolicyAssignment -Name 'PolicyAssignment07' -Scope $ResourceGroup.ResourceId
Get-AzPolicyExemption -PolicyAssignmentIdFilter $Assignment.Id
```

The first command gets a policy assignment named PolicyAssignment07.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The **ResourceId** property of $ResourceGroup identifies the resource group.
```powershell
$ResourceGroup = Get-AzResourceGroup -Name 'ResourceGroup11'
$PolicyAssignment = Get-AzPolicyAssignment -Name 'PolicyAssignment07' -Scope $ResourceGroup.ResourceId
Remove-AzPolicyAssignment -Id $PolicyAssignment.ResourceId -Confirm:$false
Remove-AzPolicyAssignment -Id $PolicyAssignment.Id -Confirm:$false
```

The first command gets a resource group named ResourceGroup11, and then stores that object in the $ResourceGroup variable.
Expand All @@ -24,7 +24,7 @@ The final command removes the policy assignment that the **ResourceId** property
### Example 3: [Backcompat] Remove policy assignment by ID
```powershell
$ResourceGroup = Get-AzResourceGroup -Name 'ResourceGroup11'
$PolicyAssignment = Get-AzPolicyAssignment -Name 'PolicyAssignment07' -Scope $ResourceGroup.ResourceId
$PolicyAssignment = Get-AzPolicyAssignment -Name 'PolicyAssignment07' -Scope $ResourceGroup.ResourceId -BackwardCompatible
Remove-AzPolicyAssignment -Id $PolicyAssignment.ResourceId -Confirm:$false -BackwardCompatible
True
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ This command removes the specified policy definition.
### Example 2: Remove policy definition by resource ID
```powershell
$PolicyDefinition = Get-AzPolicyDefinition -Name 'VMPolicyDefinition'
Remove-AzPolicyDefinition -Id $PolicyDefinition.ResourceId -Force
Remove-AzPolicyDefinition -Id $PolicyDefinition.Id -Force
```

This command removes the given policy definition without prompting the user.

### Example 3: [Backcompat] Remove policy definition by resource ID
```powershell
$PolicyDefinition = Get-AzPolicyDefinition -Name 'VMPolicyDefinition'
$PolicyDefinition = Get-AzPolicyDefinition -Name 'VMPolicyDefinition' -BackwardCompatible
Remove-AzPolicyDefinition -Id $PolicyDefinition.ResourceId -Force -BackwardCompatible
True
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The **ResourceId** property of $ResourceGroup identifies the resource group.
```powershell
$ResourceGroup = Get-AzResourceGroup -Name 'ResourceGroup11'
$PolicyExemption = Get-AzPolicyExemption -Name 'PolicyExemption07' -Scope $ResourceGroup.ResourceId
Remove-AzPolicyExemption -Id $PolicyExemption.ResourceId -Confirm
Remove-AzPolicyExemption -Id $PolicyExemption.Id -Confirm
```

The first command gets a resource group named ResourceGroup11, and then stores that object in the $ResourceGroup variable.
Expand All @@ -24,7 +24,7 @@ The final command removes the policy exemption that the **ResourceId** property
### Example 3: [Backcompat] Remove policy exemption by ID
```powershell
$ResourceGroup = Get-AzResourceGroup -Name 'ResourceGroup11'
$PolicyExemption = Get-AzPolicyExemption -Name 'PolicyExemption07' -Scope $ResourceGroup.ResourceId
$PolicyExemption = Get-AzPolicyExemption -Name 'PolicyExemption07' -Scope $ResourceGroup.ResourceId -BackwardCompatible
Remove-AzPolicyExemption -Id $PolicyExemption.ResourceId -Force -BackwardCompatible
True
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Example 1: Remove policy set definition by resource ID
```powershell
$PolicySetDefinition = Get-AzPolicySetDefinition -ResourceId '/subscriptions/mySub/Microsoft.Authorization/policySetDefinitions/myPSSetDefinition'
Remove-AzPolicySetDefinition -Id $PolicySetDefinition.ResourceId -Force
Remove-AzPolicySetDefinition -Id $PolicySetDefinition.Id -Force
```

The first command gets a policy set definition by using the Get-AzPolicySetDefinition cmdlet.
Expand All @@ -10,7 +10,7 @@ The second command removes the policy set definition identified by the **Resourc

### Example 2: [Backcompat] Remove policy set definition by resource ID
```powershell
$PolicySetDefinition = Get-AzPolicySetDefinition -ResourceId '/subscriptions/mySub/Microsoft.Authorization/policySetDefinitions/myPSSetDefinition'
$PolicySetDefinition = Get-AzPolicySetDefinition -ResourceId '/subscriptions/mySub/Microsoft.Authorization/policySetDefinitions/myPSSetDefinition' -BackwardCompatible
Remove-AzPolicySetDefinition -Id $PolicySetDefinition.ResourceId -Force -BackwardCompatible
True
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
```powershell
$ResourceGroup = Get-AzResourceGroup -Name 'ResourceGroup11'
$PolicyAssignment = Get-AzPolicyAssignment -Name 'PolicyAssignment' -Scope $ResourceGroup.ResourceId
Update-AzPolicyAssignment -Id $PolicyAssignment.ResourceId -DisplayName 'Do not allow VM creation'
Update-AzPolicyAssignment -Id $PolicyAssignment.Id -DisplayName 'Do not allow VM creation'
```

The first command gets a resource group named ResourceGroup11 by using the Get-AzResourceGroup cmdlet.
Expand All @@ -14,7 +14,7 @@ The final command updates the display name on the policy assignment on the resou
### Example 2: Add a system assigned managed identity to the policy assignment
```powershell
$PolicyAssignment = Get-AzPolicyAssignment -Name 'PolicyAssignment'
Update-AzPolicyAssignment -Id $PolicyAssignment.ResourceId -IdentityType 'SystemAssigned' -Location 'westus'
Update-AzPolicyAssignment -Id $PolicyAssignment.Id -IdentityType 'SystemAssigned' -Location 'westus'
```

The first command gets the policy assignment named PolicyAssignment from the current subscription by using the Get-AzPolicyAssignment cmdlet.
Expand All @@ -25,7 +25,7 @@ The final command assigns a system assigned managed identity to the policy assig
```powershell
$PolicyAssignment = Get-AzPolicyAssignment -Name 'PolicyAssignment'
$UserAssignedIdentity = Get-AzUserAssignedIdentity -ResourceGroupName 'ResourceGroup1' -Name 'UserAssignedIdentity1'
Update-AzPolicyAssignment -Id $PolicyAssignment.ResourceId -IdentityType 'UserAssigned' -Location 'westus' -IdentityId $UserAssignedIdentity.Id
Update-AzPolicyAssignment -Id $PolicyAssignment.Id -IdentityType 'UserAssigned' -Location 'westus' -IdentityId $UserAssignedIdentity.Id
```

The first command gets the policy assignment named PolicyAssignment from the current subscription by using the Get-AzPolicyAssignment cmdlet.
Expand All @@ -38,7 +38,7 @@ The final command assigns the user assigned managed identity identified by the *
$Locations = Get-AzLocation | Where-Object {($_.displayname -like 'france*') -or ($_.displayname -like 'uk*')}
$AllowedLocations = @{'listOfAllowedLocations'=($Locations.location)}
$PolicyAssignment = Get-AzPolicyAssignment -Name 'PolicyAssignment'
Update-AzPolicyAssignment -Id $PolicyAssignment.ResourceId -PolicyParameterObject $AllowedLocations
Update-AzPolicyAssignment -Id $PolicyAssignment.Id -PolicyParameterObject $AllowedLocations
```

The first and second commands create an object containing all Azure regions whose names start with "france" or "uk".
Expand Down Expand Up @@ -72,7 +72,7 @@ The command updates the policy assignment named 'PolicyAssignment' using the pol
```powershell
$ResourceGroup = Get-AzResourceGroup -Name 'ResourceGroup11'
$PolicyAssignment = Get-AzPolicyAssignment -Name 'PolicyAssignment' -Scope $ResourceGroup.ResourceId
Update-AzPolicyAssignment -Id $PolicyAssignment.ResourceId -EnforcementMode Default
Update-AzPolicyAssignment -Id $PolicyAssignment.Id -EnforcementMode Default
```

The first command gets a resource group named ResourceGroup11 by using the Get-AzResourceGroup cmdlet.
Expand All @@ -84,7 +84,7 @@ The final command updates the enforcementMode property on the policy assignment
### Example 7: Update non-compliance messages
```powershell
$PolicyAssignment = Get-AzPolicyAssignment -Name 'VirtualMachinePolicy'
Update-AzPolicyAssignment -Id $PolicyAssignment.ResourceId -NonComplianceMessage @{Message="All resources must follow resource naming guidelines."}
Update-AzPolicyAssignment -Id $PolicyAssignment.Id -NonComplianceMessage @{Message="All resources must follow resource naming guidelines."}
```

The first command gets the policy assignment named VirtualMachinePolicy by using the Get-AzPolicyAssignment cmdlet and stores it in the $PolicyAssignment variable.
Expand Down Expand Up @@ -113,7 +113,7 @@ The final command updates the policy assignment named VirtualMachinePolicyAssign
### Example 10: [Backcompat] Update an enforcementMode
```powershell
$ResourceGroup = Get-AzResourceGroup -Name 'ResourceGroup11'
$PolicyAssignment = Get-AzPolicyAssignment -Name 'PolicyAssignment' -Scope $ResourceGroup.ResourceId
$PolicyAssignment = Get-AzPolicyAssignment -Name 'PolicyAssignment' -Scope $ResourceGroup.ResourceId -BackwardCompatible
Set-AzPolicyAssignment -Id $PolicyAssignment.ResourceId -EnforcementMode Default
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
### Example 1: Update the description of a policy definition
```powershell
$PolicyDefinition = Get-AzPolicyDefinition -Name 'VMPolicyDefinition'
Update-AzPolicyDefinition -Id $PolicyDefinition.ResourceId -Description 'Updated policy to not allow virtual machine creation'
Update-AzPolicyDefinition -Id $PolicyDefinition.Id -Description 'Updated policy to not allow virtual machine creation'
```

The first command gets a policy definition named VMPolicyDefinition by using the Get-AzPolicyDefinition cmdlet.
The command stores that object in the $PolicyDefinition variable.
The second command updates the description of the policy definition identified by the **ResourceId** property of $PolicyDefinition.
The second command updates the description of the policy definition identified by the **Id** property of $PolicyDefinition.

### Example 2: Update the mode of a policy definition
```powershell
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### Example 1: Update the display name
```powershell
$ResourceGroup = Get-AzResourceGroup -Name 'ResourceGroup11'
$PolicyExemption = Get-AzPolicyExemption -Name 'PolicyExemption07' -Scope $ResourceGroup.ResourceId
Update-AzPolicyExemption -Id $PolicyExemption.ResourceId -DisplayName 'Exempt VM creation limit'
$PolicyExemption = Get-AzPolicyExemption -Name 'PolicyExemption07' -Scope $ResourceGroup.ResourceId
Update-AzPolicyExemption -Id $PolicyExemption.Id -DisplayName 'Exempt VM creation limit'
```

The first command gets a resource group named ResourceGroup11 by using the Get-AzResourceGroup cmdlet.
Expand All @@ -15,7 +15,7 @@ The final command updates the display name on the policy exemption on the resour
```powershell
$NextMonth = (Get-Date).AddMonths(1)
$PolicyExemption = Get-AzPolicyExemption -Name 'PolicyExemption07'
Update-AzPolicyExemption -Id $PolicyExemption.ResourceId -ExpiresOn $NextMonth
Update-AzPolicyExemption -Id $PolicyExemption.Id -ExpiresOn $NextMonth
```

The first command gets the current date time by using the Get-Date cmdlet and add 1 month to the current date time
Expand All @@ -27,7 +27,7 @@ The final command updates the expiration date time for the policy exemption on t
### Example 3: Clear the expiration date time
```powershell
$PolicyExemption = Get-AzPolicyExemption -Name 'PolicyExemption07'
Update-AzPolicyExemption -Id $PolicyExemption.ResourceId -ClearExpiration
Update-AzPolicyExemption -Id $PolicyExemption.Id -ClearExpiration
```

The first command gets the policy exemption named PolicyExemption07 by using the Get-AzPolicyExemption cmdlet.
Expand All @@ -38,7 +38,7 @@ The updated exemption will never expire.
### Example 4: Update the expiration category
```powershell
$PolicyExemption = Get-AzPolicyExemption -Name 'PolicyExemption07'
Update-AzPolicyExemption -Id $PolicyExemption.ResourceId -ExemptionCategory Mitigated
Update-AzPolicyExemption -Id $PolicyExemption.Id -ExemptionCategory Mitigated
```

The first command gets the policy exemption named PolicyExemption07 by using the Get-AzPolicyExemption cmdlet.
Expand All @@ -63,8 +63,8 @@ The final command updates the policy exemption named VirtualMachineExemption wit

### Example 6: [Backcompat] Clear the expiration date time
```powershell
$PolicyExemption = Get-AzPolicyExemption -Name 'PolicyExemption07'
Set-AzPolicyExemption -Id $PolicyExemption.ResourceId -ClearExpiration
$PolicyExemption = Get-AzPolicyExemption -Name 'PolicyExemption07' -BackwardCompatible
Set-AzPolicyExemption -Id $PolicyExemption.ResourceId -ClearExpiration -BackwardCompatible
```

The first command gets the policy exemption named PolicyExemption07 by using the Get-AzPolicyExemption cmdlet.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
### Example 1: Update the description of a policy set definition
```powershell
$PolicySetDefinition = Get-AzPolicySetDefinition -ResourceId '/subscriptions/mySub/Microsoft.Authorization/policySetDefinitions/myPSSetDefinition'
Update-AzPolicySetDefinition -Id $PolicySetDefinition.ResourceId -Description 'Updated policy to not allow virtual machine creation'
$PolicySetDefinition = Get-AzPolicySetDefinition -Id '/subscriptions/mySub/Microsoft.Authorization/policySetDefinitions/myPSSetDefinition'
Update-AzPolicySetDefinition -Id $PolicySetDefinition.Id -Description 'Updated policy to not allow virtual machine creation'
```

The first command gets a policy set definition by using the Get-AzPolicySetDefinition cmdlet.
The command stores that object in the $PolicySetDefinition variable.
The second command updates the description of the policy set definition identified by the **ResourceId** property of $PolicySetDefinition.
The second command updates the description of the policy set definition identified by the **Id** property of $PolicySetDefinition.

### Example 2: Update the metadata of a policy set definition
```powershell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ Get-AzPolicyExemption
$ResourceGroup = Get-AzResourceGroup -Name 'ResourceGroup11'
Get-AzPolicyExemption -Name 'PolicyExemption07' -Scope $ResourceGroup.ResourceId
.Example
$Assignment = Get-AzPolicyAssignment -Name 'PolicyAssignment07'
Get-AzPolicyExemption -PolicyAssignmentIdFilter $Assignment.ResourceId
$ResourceGroup = Get-AzResourceGroup -Name 'ResourceGroup11'
$Assignment = Get-AzPolicyAssignment -Name 'PolicyAssignment07' -Scope $ResourceGroup.ResourceId
Get-AzPolicyExemption -PolicyAssignmentIdFilter $Assignment.Id
.Inputs
System.Management.Automation.SwitchParameter
Expand Down
Loading

0 comments on commit 6031f0f

Please sign in to comment.