@@ -169,50 +169,51 @@ This doesn't affect the workings of the parameter file or deployment.
169
169
The reason for the warning is that the ` metadata ` property has not been added to the parameter file JSON schema.
170
170
However, the top level ` metadata ` property is ignored by Azure Resource Manager when deploying a template.
171
171
172
- ## A warning is reported for Az.Resources
172
+ ## Issues with Az.Resources
173
173
174
- When running PSRule or importing ` PSRule.Rules.Azure ` on the command-line you see a message similar to the following:
174
+ The PowerShell module ` Az.Resources ` and ` Az.Accounts ` is currently used when exporting data from Azure.
175
+ These modules are use when:
176
+
177
+ - Exporting resources for in-flight analysis.
178
+ - Exporting policy assignments for policy as rules.
179
+
180
+ These modules are not required if you only want to execute rules.
181
+
182
+ ### Suppression of Az.Resources warning
183
+
184
+ If you only intend to execute rules you can suppress the following warning message.
175
185
176
186
!!! Message
177
187
178
188
To use PSRule for Azure export cmdlets please install Az.Resources.
179
189
180
- This warning flags that when running ` Export-* ` cmdlets for PSRule for Azure, the ` Az.Resources ` module is required.
181
- If you intend to call these cmdlets, first install the ` Az.Resources ` module.
182
- Otherwise this warning message can be ignored.
183
-
190
+ This message can be ignored if you are not exporting data from Azure.
184
191
To suppress the warning configure the ` PSRULE_AZURE_RESOURCE_MODULE_NOWARN ` environment variable to ` true ` .
185
192
For more details see [ Configuring exports] ( setup/configuring-exports.md#psrule_azure_resource_module_nowarn ) .
186
193
187
- ## An earlier version of Az.Accounts is imported
194
+ ### Installing Az.Resources
195
+
196
+ If you plan on exporting data from Azure, you must install the ` Az.Resources ` module.
188
197
189
- When running PSRule for Azure in Azure DevOps within the ` AzurePowerShell@5 ` task,
190
- you may see the following error.
198
+ Some versions of ` Az.Resources ` are known to be incompatible with PSRule for Azure.
199
+ As a result, we recommend installing and importing v6.16.2 to address these issues.
200
+ A known incompatibility currently exists with v7.1.0 ([ #2970 ] ( https://github.com/Azure/PSRule.Rules.Azure/issues/2970 ) ).
201
+ By default, PowerShell will attempt to install or use a newer version already installed which may return an error.
191
202
192
203
!!! Message
193
204
194
- This module requires Az.Accounts version 2.8.0. An earlier version of
195
- Az.Accounts is imported in the current PowerShell session. Please open a new
196
- session before importing this module. This error could indicate that multiple
197
- incompatible versions of the Azure PowerShell cmdlets are installed on your
198
- system. Please see https://aka.ms/azps-version-error for troubleshooting
199
- information.
205
+ ExpandPolicyAssignment: The property 'Properties' cannot be found on this object. Verify that the property exists.
200
206
201
- This error is raised by a chained dependency failure importing a newer version of ` Az.Accounts ` .
202
- To avoid this issue attempt to install the exact versions of ` Az.Resources ` .
203
- In the ` AzurePowerShell@5 ` task before installing PSRule.
207
+ To install a specific version use:
204
208
205
209
``` powershell title="PowerShell"
206
- Install-Module Az.Resources -RequiredVersion '7.1.0 ' -Force -Scope CurrentUser
210
+ Install-Module Az.Resources -RequiredVersion '6.16.2 ' -Force -Scope CurrentUser
207
211
```
208
212
209
- From PSRule for Azure v1.16.0, ` Az.Accounts ` and ` Az.Resources ` are no longer installed as dependencies.
210
- When using export commands from PSRule, you may need to install these modules.
211
-
212
- To install these modules, use the following PowerShell command:
213
+ To import a specific version prior to using PSRule:
213
214
214
215
``` powershell title="PowerShell"
215
- Install -Module Az.Resources -Force -Scope CurrentUser
216
+ Import -Module Az.Resources -RequiredVersion '6.16.2'
216
217
```
217
218
218
219
## Could not load file or assembly YamlDotNet
0 commit comments