Skip to content

Commit ec94720

Browse files
Merge pull request #232539 from shanhix1/shannon/remove-deprecated-github-action
Remove deprecated GitHub export / Github action references
2 parents 083251b + f016255 commit ec94720

File tree

7 files changed

+35
-294
lines changed

7 files changed

+35
-294
lines changed

.openpublishing.redirection.azure-resource-manager.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1919,6 +1919,11 @@
19191919
"source_path_from_root": "/articles/azure-resource-manager/managed-applications/scripts/managed-application-powershell-sample-get-managed-group-resize-vm.md",
19201920
"redirect_url": "/azure/azure-resource-manager/managed-applications/overview",
19211921
"redirect_document_id": false
1922-
}
1922+
},
1923+
{
1924+
"source_path_from_root": "/articles/governance/policy/tutorials/policy-as-code-github.md",
1925+
"redirect_url": "/azure/governance/policy/concepts/policy-as-code",
1926+
"redirect_document_id": false
1927+
}
19231928
]
19241929
}

articles/governance/policy/concepts/definition-structure.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ see [Tag support for Azure resources](../../../azure-resource-manager/management
137137
The following Resource Provider modes are fully supported:
138138

139139
- `Microsoft.Kubernetes.Data` for managing Kubernetes clusters and components such as pods, containers, and ingresses. Supported for Azure Kubernetes Service clusters and [Azure Arc-enabled Kubernetes clusters](../../../aks/intro-kubernetes.md). Definitions
140-
using this Resource Provider mode use effects _audit_, _deny_, and _disabled_.
140+
using this Resource Provider mode use effects _audit_, _deny_, and _disabled_.
141141
- `Microsoft.KeyVault.Data` for managing vaults and certificates in
142142
[Azure Key Vault](../../../key-vault/general/overview.md). For more information on these policy
143143
definitions, see
@@ -1174,7 +1174,7 @@ Limits to the size of objects that are processed by policy functions during poli
11741174
}
11751175
```
11761176

1177-
The length of the string created by the `concat()` function depends of the value of properties in the evaluated resource.
1177+
The length of the string created by the `concat()` function depends on the value of properties in the evaluated resource.
11781178

11791179
| Limit | Value | Example |
11801180
|:---|:---|:---|

articles/governance/policy/concepts/policy-as-code.md

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,30 @@ in the cloud are:
1818
end users.
1919

2020
Azure Policy as Code is the combination of these ideas. Essentially, keep your policy definitions in
21-
source control and whenever a change is made, test, and validate that change. However, that
21+
source control and whenever a change is made, test and validate that change. However, that
2222
shouldn't be the extent of policies involvement with Infrastructure as Code or DevOps.
2323

2424
The validation step should also be a component of other continuous integration or continuous
25-
deployment workflows. Examples include deploying an application environment or virtual
26-
infrastructure. By making Azure Policy validation an early component of the build and deployment
27-
process the application and operations teams discover if their changes are non-compliant, long
25+
deployment (CI/CD) workflows, like deploying an application environment or virtual infrastructure. By making Azure Policy validation an early component of the build and deployment process, the application and operations teams discover if their changes are behaving as expected long
2826
before it's too late and they're attempting to deploy in production.
2927

3028
## Definitions and foundational information
3129

32-
Before getting into the details of Azure Policy as Code workflow, review the following definitions
33-
and examples:
30+
Before getting into the details of Azure Policy as Code workflow, it's important to understand how to author policy definitions and initiative definitions:
3431

3532
- [Policy definition](./definition-structure.md)
3633
- [Initiative definition](./initiative-definition-structure.md)
3734

38-
The file names align to portions of either the policy or initiative definition:
39-
- `policy(set).json` - The entire definition
40-
- `policy(set).parameters.json` - The `properties.parameters` portion of the definition
41-
- `policy.rules.json` - The `properties.policyRule` portion of the definition
42-
- `policyset.definitions.json` - The `properties.policyDefinitions` portion of the definition
35+
The file names correspond with certain portions of policy or initiative definitions:
36+
37+
| File format | File contents |
38+
| :-- | :-- |
39+
| `policy.json` | The entire policy definition |
40+
| `policyset.json` | The entire initiative definition |
41+
| `policy.parameters.json` | The `properties.parameters` portion of the policy definition |
42+
| `policyset.parameters.json` | The `properties.parameters` portion of the initiative definition |
43+
| `policy.rules.json` | The `properties.policyRule` portion of the policy definition |
44+
| `policyset.definitions.json` | The `properties.policyDefinitions` portion of the initiative definition |
4345

4446
Examples of these file formats are available in the
4547
[Azure Policy GitHub Repo](https://github.com/Azure/azure-policy/):
@@ -55,6 +57,10 @@ The recommended general workflow of Azure Policy as Code looks like this diagram
5557
The diagram showing the Azure Policy as Code workflow boxes. Create covers creation of the policy and initiative definitions. Test covers assignment with enforcement mode disabled. A gateway check for the compliance status is followed by granting the assignments M S I permissions and remediating resources. Deploy covers updating the assignment with enforcement mode enabled.
5658
:::image-end:::
5759

60+
### Source control
61+
62+
Existing policy and initiative definitions can be exported through PowerShell, CLI, or [Azure Resource Graph (ARG)](../../resource-graph/overview.md) queries. The source control management environment of choice to store these definitions can be one of many options, including a [GitHub](https://www.github.com) or [Azure DevOps](/azure/devops/user-guide/what-is-azure-devops).
63+
5864
### Create and update policy definitions
5965

6066
The policy definitions are created using JSON, and stored in source control. Each policy has its
@@ -81,17 +87,12 @@ in source control.
8187
|
8288
```
8389

84-
When a new policy is added or an existing one updated, the workflow should automatically update the
90+
When a new policy is added or an existing one is updated, the workflow should automatically update the
8591
policy definition in Azure. Testing of the new or updated policy definition comes in a later step.
8692

87-
Also, review [Export Azure Policy resources](../how-to/export-resources.md) to get your existing
88-
definitions and assignments into the source code management environment
89-
[GitHub](https://www.github.com).
90-
9193
### Create and update initiative definitions
9294

93-
Likewise, initiatives have their own JSON file and related files that should be stored in the same
94-
folder. The initiative definition requires the policy definition to already exist, so can't be
95+
Initiative definitions are also created using JSON files that should be stored in the same folder as policy definitions. The initiative definition requires the policy definition to already exist, so it can't be
9596
created or updated until the source for the policy has been updated in source control and then
9697
updated in Azure. The following structure is a recommended way of keeping your initiative
9798
definitions in source control:
@@ -116,8 +117,8 @@ definitions in source control:
116117
|
117118
```
118119

119-
Like policy definitions, when adding or updating an existing initiative, the workflow should
120-
automatically update the initiative definition in Azure. Testing of the new or updated initiative
120+
Like with policy definitions, the workflow should
121+
automatically update the initiative definition in Azure when an existing initiative is added or updated. Testing of the new or updated initiative
121122
definition comes in a later step.
122123

123124
> [!NOTE]
@@ -146,22 +147,17 @@ specifically for validating policies.
146147
> the resource.
147148
148149
After the assignment is deployed, use the Azure Policy SDK, the
149-
[Azure Policy Compliance Scan GitHub Action](https://github.com/marketplace/actions/azure-policy-compliance-scan),
150-
or the
151-
[Azure Pipelines Security and Compliance Assessment task](/azure/devops/pipelines/tasks/deploy/azure-policy)
152-
to [get compliance data](../how-to/get-compliance-data.md) for the new assignment. The environment
153-
used to test the policies and assignments should have both compliant and non-compliant resources.
154-
Like a good unit test for code, you want to test that resources are as expected and that you also
155-
have no false-positives or false-negatives. If you test and validate only for what you expect, there
150+
[Azure Pipelines Security and Compliance Assessment task](/azure/devops/pipelines/tasks/deploy/azure-policy), or [Azure Resource Graph (ARG)](../../resource-graph/overview.md) queries (see [samples](../samples/resource-graph-samples.md)) to [get compliance data](../how-to/get-compliance-data.md) for the new assignment. The environment
151+
used to test the policies and assignments should have resources with varying compliance states.
152+
Like a good unit test for code, you want to test that resources are evaluated as expected with no false-positives or false-negatives. If you test and validate only for what you expect, there
156153
may be unexpected and unidentified impact from the policy. For more information, see
157154
[Evaluate the impact of a new Azure Policy definition](./evaluate-impact.md).
158155

159156
### Enable remediation tasks
160157

161158
If validation of the assignment meets expectations, the next step is to validate remediation.
162159
Policies that use either [deployIfNotExists](./effects.md#deployifnotexists) or
163-
[modify](./effects.md#modify) may be turned into a remediation task and correct resources from a
164-
non-compliant state.
160+
[modify](./effects.md#modify) can have an associated remediation task triggered to correct resources from a non-compliant state and bring them into compliance.
165161

166162
The first step to remediating resources is to grant the policy assignment the role assignment
167163
defined in the policy definition. This role assignment gives the policy assignment managed identity
@@ -206,9 +202,7 @@ workflows, and fail deployments that create non-compliant resources.
206202

207203
This article covers the general workflow for Azure Policy as Code and also where policy evaluation
208204
should be part of other deployment workflows. This workflow can be used in any environment that
209-
supports scripted steps and automation based on triggers. For a tutorial on using this workflow on
210-
GitHub, see
211-
[Tutorial: Implement Azure Policy as Code with GitHub](../tutorials/policy-as-code-github.md).
205+
supports scripted steps and automation based on triggers.
212206

213207
## Next steps
214208

articles/governance/policy/how-to/export-resources.md

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -13,77 +13,10 @@ ms.author: timwarner
1313
This article provides information on how to export your existing Azure Policy resources. Exporting
1414
your resources is useful and recommended for backup, but is also an important step in your journey
1515
with Cloud Governance and treating your [policy-as-code](../concepts/policy-as-code.md). Azure
16-
Policy resources can be exported through [Azure portal](#export-with-azure-portal),
16+
Policy resources can be exported through
1717
[Azure CLI](#export-with-azure-cli), [Azure PowerShell](#export-with-azure-powershell), and each of
1818
the supported SDKs.
1919

20-
## Export with Azure portal
21-
22-
> [!NOTE]
23-
> Exporting Azure Policy resources from the Azure portal isn't available for Azure sovereign clouds.
24-
25-
To export a policy definition from Azure portal, follow these steps:
26-
27-
1. Launch the Azure Policy service in the Azure portal by clicking **All services**, then searching
28-
for and selecting **Policy**.
29-
30-
1. Select **Definitions** on the left side of the Azure Policy page.
31-
32-
1. Use the **Export definitions** button or select the ellipsis on the row of a policy definition
33-
and then select **Export definition**.
34-
35-
1. Select the **Sign in with GitHub** button. If you haven't yet authenticated with GitHub to
36-
authorize Azure Policy to export the resource, review the access the
37-
[GitHub Action](https://github.com/features/actions) needs in the new window that opens and
38-
select **Authorize AzureGitHubActions** to continue with the export process. Once complete, the
39-
new window self-closes.
40-
41-
1. On the **Basics** tab, set the following options, then select the **Policies** tab or **Next :
42-
Policies** button at the bottom of the page.
43-
44-
- **Repository filter**: Set to _My repositories_ to see only repositories you own or _All
45-
repositories_ to see all you granted the GitHub Actions access to.
46-
- **Repository**: Set to the repository that you want to export the Azure Policy resources to.
47-
- **Branch**: Set the branch in the repository. Using a branch other than the default is a good
48-
way to validate your updates before merging further into your source code.
49-
- **Directory**: The _root level folder_ to export the Azure Policy resources to. Subfolders
50-
under this directory are created based on what resources are exported.
51-
52-
1. On the **Policies** tab, set the scope to search by selecting the ellipsis and picking a
53-
combination of management groups, subscriptions, or resource groups.
54-
55-
1. Use the **Add policy definition(s)** button to search the scope for which objects to export. In
56-
the side window that opens, select each object to export. Filter the selection by the search box
57-
or the type. Once you've selected all objects to export, use the **Add** button at the bottom of
58-
the page.
59-
60-
1. For each selected object, select the desired export options such as _Only Definition_ or
61-
_Definition and Assignment(s)_ for a policy definition. Then select the **Review + Export** tab
62-
or **Next : Review + Export** button at the bottom of the page.
63-
64-
> [!NOTE]
65-
> If option _Definition and Assignment(s)_ is chosen, only policy assignments within the scope
66-
> set by the filter when the policy definition is added are exported.
67-
68-
1. On the **Review + Export** tab, check the details match and then use the **Export** button at the
69-
bottom of the page.
70-
71-
1. Check your GitHub repo, branch, and _root level folder_ to see that the selected resources are
72-
now exported to your source control.
73-
74-
The Azure Policy resources are exported into the following structure within the selected GitHub
75-
repository and _root level folder_:
76-
77-
```text
78-
|
79-
|- <root level folder>/ ________________ # Root level folder set by Directory property
80-
| |- policies/ ________________________ # Subfolder for policy objects
81-
| |- <displayName>_<name>____________ # Subfolder based on policy displayName and name properties
82-
| |- policy.json _________________ # Policy definition
83-
| |- assign.<displayName>_<name>__ # Each assignment (if selected) based on displayName and name properties
84-
|
85-
```
86-
8720
## Export with Azure CLI
8821

8922
Azure Policy definitions, initiatives, and assignments can each be exported as JSON with

articles/governance/policy/index.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ landingContent:
6969
url: ./how-to/extension-for-vscode.md
7070
- text: Design Azure Policy as Code workflows
7171
url: ./concepts/policy-as-code.md
72-
- text: Implement Azure Policy as Code with GitHub
73-
url: ./tutorials/policy-as-code-github.md
7472
- linkListType: deploy
7573
links:
7674
- text: Index of policy samples

articles/governance/policy/toc.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@
5454
- name: Route policy state change events
5555
displayName: event grid, subject, topic, subscription
5656
href: ./tutorials/route-state-change-events.md
57-
- name: Implement Azure Policy as Code with GitHub
58-
displayName: devops, infrastructure as code, iac, release, continuous, delivery, deploy
59-
href: ./tutorials/policy-as-code-github.md
6057
- name: Implement Azure Policy with Azure DevOps
6158
displayName: devops, pipelines, releases
6259
href: ./tutorials/policy-devops-pipelines.md

0 commit comments

Comments
 (0)