PolicySetDefinitions #16875
Replies: 2 comments 1 reply
-
@pattisanta Your Bicep syntax looks correct to me. What error message do you get? I reproduced your code and deployed it to my Azure tenant, and it deploys without errors: var policies = [
{
defRefId: 'App Service apps should be injected into a virtual network_1'
defId: tenantResourceId('Microsoft.Authorization/policyDefinitions' ,'72d04c29-f87d-4575-9731-419ff16a2757')
parameters: {
effect: {
value: 'deny'
}
}
}
{
defRefId: 'App Service apps should use a SKU that supports private link_1'
defId: tenantResourceId('Microsoft.Authorization/policyDefinitions' ,'546fe8d2-368d-4029-a418-6af48a7f61e5')
parameters: {
effect: {
value: 'deny'
}
}
}
{
defRefId: 'App Service Environment should be configured with strongest TLS Cipher suites_1'
defId: tenantResourceId('Microsoft.Authorization/policyDefinitions' ,'817dcf37-e83d-4999-a472-644eada2ea1e')
parameters: {
effect: {
value: 'deny'
}
}
}
]
var policiesFor = [for policy in policies: {
policyDefinitionReferenceId: policy.defRefId
policyDefinitionId: policy.defId
parameters: policy.parameters
}]
var policiesMap = map(policies, policy => {
policyDefinitionReferenceId: policy.defRefId
policyDefinitionId: policy.defId
parameters: policy.parameters
})
output outOutputArrayObject array = policies
output outOutputFor array = policiesFor
output outOutputMap array = policiesMap
|
Beta Was this translation helpful? Give feedback.
-
@johnlokerse This is the error that I am getting. 'The template parameter 'policy parameter name' is not found. This one I know works. Thanks for responding, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi I need to deploy policy initiative. I'm having an issue with looping thru policy to create the initiative. here is an example of what I have tired with one way working and the way does not work.
targetScope = 'subscription'
var parameters = {
AppServiceappsshouldbeinjectedintoavirtualnetwork: {
type: 'String'
defaultValue: 'Deny'
allowedValues: [
'Audit'
'Deny'
'Disabled'
]
metadata: {
displayName: 'App Service apps should be injected into a virtual network'
description: 'Enable or disable the execution of the policy'
}
}
AppServiceappsshoulduseaSKUthatsupportsprivatelink: {
type: 'String'
defaultValue: 'Disabled'
allowedValues: [
'Audit'
'Deny'
'Disabled'
]
metadata: {
displayName: 'App Service apps should use a SKU that supports private link'
description: 'Enable or disable the execution of the policy'
}
}
AppServiceEnvironmentshouldbeconfiguredwithstrongestTLSCiphersuites: {
type: 'String'
defaultValue: 'Audit'
allowedValues: [
'Audit'
'Disabled'
]
metadata: {
displayName: 'App Service Environment should be configured with strongest TLS Cipher suites'
description: 'Enable or disable the execution of the policy'
}
}
}
var policies = [
{
defRefId: 'App Service apps should be injected into a virtual network_1'
defId: tenantResourceId('Microsoft.Authorization/policyDefinitions' ,'72d04c29-f87d-4575-9731-419ff16a2757')
parameters: {
effect: {
value:'[parameters('AppServiceappsshouldbeinjectedintoavirtualnetwork')]'
}
}
}
{
defRefId: 'App Service apps should use a SKU that supports private link_1'
defId: tenantResourceId('Microsoft.Authorization/policyDefinitions' ,'546fe8d2-368d-4029-a418-6af48a7f61e5')
parameters: {
effect: {
value:'[parameters('AppServiceappsshoulduseaSKUthatsupportsprivatelink')]'
}
}
}
{
defRefId: 'App Service Environment should be configured with strongest TLS Cipher suites_1'
defId: tenantResourceId('Microsoft.Authorization/policyDefinitions' ,'817dcf37-e83d-4999-a472-644eada2ea1e')
parameters: {
effect: {
value:'[parameters('AppServiceEnvironmentshouldbeconfiguredwithstrongestTLSCiphersuites')]'
}
}
}
]
resource BuiltIn_Initiative 'Microsoft.Authorization/policySetDefinitions@2021-06-01' = {
name: 'MyTestPolicyInitiative'
properties: {
displayName: 'MyTestPolicyInitiative'
policyType: 'Custom'
description: 'This Initiative contains BuiltIn Policies'
metadata: {
category: 'General'
}
}
}
Regards,
Patti
Beta Was this translation helpful? Give feedback.
All reactions