Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azure-functions:deploy goal fails when there is an azure policy assigned on that subscription #876

Open
saikovvuri opened this issue Oct 30, 2019 · 3 comments

Comments

@saikovvuri
Copy link

saikovvuri commented Oct 30, 2019

Plugin name and version

<azure.functions.maven.plugin.version>1.3.4</azure.functions.maven.plugin.version>

Plugin configuration in your pom.xml

Expected behavior

We have an azure policy that prevents that enforces TLS 1.2 for all web apps that are deployed. Running "mvn azure-functions:deploy" should deploy the function app to the azure environment

Actual behavior

Running "mvn azure-functions:deploy" goal results in the following

[ERROR] Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.3.4:deploy (default-cli) on project fabrikam-functions: c[ERROR] Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.3.4:deploy (default-cli) on project fabrikam-functions: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "evaluationDetails" (class com.microsoft.azure.PolicyViolationErrorInfo), not marked as ignorable (13 known properties: "policyDefinitionId", "policyDefinitionReferenceId", "policyDefinitionDisplayName", "policyAssignmentParameters", "policyAssignmentName", "policySetDefinitionName", "policyDefinitionName", "policyAssignmentScope", "policyDefinitionEffect", "policyAssignmentId", "policySetDefinitionId", "policySetDefinitionDisplayName", "policyAssignmentDisplayName"])
[ERROR] at [Source: (String)"{"policyDefinitionDisplayName":"Enforce TLS 1.2","evaluationDetails":{"evaluatedExpressions":[{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Web/sites","targetValue":"Microsoft.Web/sites","operator":"Equals"},{"result":"True","expressionKind":"Field","expression":"Microsoft.Web/sites/httpsOnly","path":"properties.httpsOnly","targetValue":"true","operator":"NotEquals"}]},"policyDefinitionId":"/subscriptions/c65"[truncated 549 chars]; line: 1, column: 71] (through reference chain: com.microsoft.azure.CloudError["additionalInfo"]->java.util.ArrayList[0]->com.microsoft.azure.PolicyViolationErrorInfo["evaluationDetails"])
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.3.4:deploy (default-cli) on project fabrikam-functions: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "evaluationDetails" (class com.microsoft.azure.PolicyViolationErrorInfo), not marked as ignorable (13 known properties: "policyDefinitionId", "policyDefinitionReferenceId", "policyDefinitionDisplayName", "policyAssignmentParameters", "policyAssignmentName", "policySetDefinitionName", "policyDefinitionName", "policyAssignmentScope", "policyDefinitionEffect", "policyAssignmentId", "policySetDefinitionId", "policySetDefinitionDisplayName", "policyAssignmentDisplayName"])
at [Source: (String)"{"policyDefinitionDisplayName":"Enforce TLS 1.2","evaluationDetails":{"evaluatedExpressions":[{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Web/sites","targetValue":"Microsoft.Web/sites","operator":"Equals"},{"result":"True","expressionKind":"Field","expression":"Microsoft.Web/sites/httpsOnly","path":"properties.httpsOnly","targetValue":"true","operator":"NotEquals"}]},"policyDefinitionId":"/subscriptions/c65"[truncated 549 chars]; line: 1, column: 71] (through reference chain: com.microsoft.azure.CloudError["additionalInfo"]->java.util.ArrayList[0]->com.microsoft.azure.PolicyViolationErrorInfo["evaluationDetails"])
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "evaluationDetails" (class com.microsoft.azure.PolicyViolationErrorInfo), not marked as ignorable (13 known properties: "policyDefinitionId", "policyDefinitionReferenceId", "policyDefinitionDisplayName", "policyAssignmentParameters", "policyAssignmentName", "policySetDefinitionName", "policyDefinitionName", "policyAssignmentScope", "policyDefinitionEffect", "policyAssignmentId", "policySetDefinitionId", "policySetDefinitionDisplayName", "policyAssignmentDisplayName"])
at [Source: (String)"{"policyDefinitionDisplayName":"Enforce TLS 1.2","evaluationDetails":{"evaluatedExpressions":[{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Web/sites","targetValue":"Microsoft.Web/sites","operator":"Equals"},{"result":"True","expressionKind":"Field","expression":"Microsoft.Web/sites/httpsOnly","path":"properties.httpsOnly","targetValue":"true","operator":"NotEquals"}]},"policyDefinitionId":"/subscriptions/c65e"[truncated 549 chars]; line: 1, column: 71] (through reference chain: com.microsoft.azure.CloudError["additionalInfo"]->java.util.ArrayList[0]->com.microsoft.azure.PolicyViolationErrorInfo["evaluationDetails"])
at com.microsoft.azure.maven.AbstractAzureMojo.handleException (AbstractAzureMojo.java:380)
at com.microsoft.azure.maven.AbstractAzureMojo.execute (AbstractAzureMojo.java:314)
at com.microsoft.azure.maven.function.AbstractFunctionMojo.execute (AbstractFunctionMojo.java:125)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "evaluationDetails" (class com.microsoft.azure.PolicyViolationErrorInfo), not marked as ignorable (13 known properties: "policyDefinitionId", "policyDefinitionReferenceId", "policyDefinitionDisplayName", "policyAssignmentParameters", "policyAssignmentName", "policySetDefinitionName", "policyDefinitionName", "policyAssignmentScope", "policyDefinitionEffect", "policyAssignmentId", "policySetDefinitionId", "policySetDefinitionDisplayName", "policyAssignmentDisplayName"])
at [Source: (String)"{"policyDefinitionDisplayName":"Enforce TLS 1.2","evaluationDetails":{"evaluatedExpressions":[{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Web/sites","targetValue":"Microsoft.Web/sites","operator":"Equals"},{"result":"True","expressionKind":"Field","expression":"Microsoft.Web/sites/httpsOnly","path":"properties.httpsOnly","targetValue":"true","operator":"NotEquals"}]},"policyDefinitionId":"/subscriptions/c65"[truncated 549 chars]; line: 1, column: 71] (through reference chain: com.microsoft.azure.CloudError["additionalInfo"]->java.util.ArrayList[0]->com.microsoft.azure.PolicyViolationErrorInfo["evaluationDetails"])
at rx.exceptions.Exceptions.propagate (Exceptions.java:57)
at rx.observables.BlockingObservable.blockForSingle (BlockingObservable.java:463)
at rx.observables.BlockingObservable.single (BlockingObservable.java:340)
at com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl.create (CreatableUpdatableImpl.java:251)
at com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl.create (CreatableUpdatableImpl.java:33)
at com.microsoft.azure.maven.function.DeployMojo.createFunctionApp (DeployMojo.java:110)
at com.microsoft.azure.maven.function.DeployMojo.createOrUpdateFunctionApp (DeployMojo.java:85)
at com.microsoft.azure.maven.function.DeployMojo.doExecute (DeployMojo.java:61)
at com.microsoft.azure.maven.AbstractAzureMojo.execute (AbstractAzureMojo.java:309)
at com.microsoft.azure.maven.function.AbstractFunctionMojo.execute (AbstractFunctionMojo.java:125)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "evaluationDetails" (class com.microsoft.azure.PolicyViolationErrorInfo), not marked as ignorable (13 known properties: "policyDefinitionId", "policyDefinitionReferenceId", "policyDefinitionDisplayName", "policyAssignmentParameters", "policyAssignmentName", "policySetDefinitionName", "policyDefinitionName", "policyAssignmentScope", "policyDefinitionEffect", "policyAssignmentId", "policySetDefinitionId", "policySetDefinitionDisplayName", "policyAssignmentDisplayName"])
at [Source: (String)"{"policyDefinitionDisplayName":"Enforce TLS 1.2","evaluationDetails":{"evaluatedExpressions":[{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Web/sites","targetValue":"Microsoft.Web/sites","operator":"Equals"},{"result":"True","expressionKind":"Field","expression":"Microsoft.Web/sites/httpsOnly","path":"properties.httpsOnly","targetValue":"true","operator":"NotEquals"}]},"policyDefinitionId":"/subscriptions/c65"[truncated 549 chars]; line: 1, column: 71] (through reference chain: com.microsoft.azure.CloudError["additionalInfo"]->java.util.ArrayList[0]->com.microsoft.azure.PolicyViolationErrorInfo["evaluationDetails"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from (UnrecognizedPropertyException.java:60)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty (DeserializationContext.java:822)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty (StdDeserializer.java:1152)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty (BeanDeserializerBase.java:1582)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla (BeanDeserializerBase.java:1560)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize (BeanDeserializer.java:294)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize (BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose (ObjectMapper.java:4001)
at com.fasterxml.jackson.databind.ObjectMapper.readValue (ObjectMapper.java:2992)
at com.microsoft.azure.PolicyViolation. (PolicyViolation.java:38)
at com.microsoft.azure.serializer.TypedErrorInfoDeserializer.deserialize (TypedErrorInfoDeserializer.java:61)
at com.microsoft.azure.serializer.TypedErrorInfoDeserializer.deserialize (TypedErrorInfoDeserializer.java:24)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize (CollectionDeserializer.java:286)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize (CollectionDeserializer.java:245)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize (CollectionDeserializer.java:27)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet (FieldProperty.java:136)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize (BeanDeserializer.java:288)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize (BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.ObjectMapper._readValue (ObjectMapper.java:3972)
at com.fasterxml.jackson.databind.ObjectMapper.readValue (ObjectMapper.java:2264)
at com.fasterxml.jackson.core.JsonParser.readValueAs (JsonParser.java:1729)
at com.microsoft.azure.serializer.CloudErrorDeserializer.deserialize (CloudErrorDeserializer.java:63)
at com.microsoft.azure.serializer.CloudErrorDeserializer.deserialize (CloudErrorDeserializer.java:24)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose (ObjectMapper.java:4001)
at com.fasterxml.jackson.databind.ObjectMapper.readValue (ObjectMapper.java:3030)
at com.microsoft.rest.serializer.JacksonAdapter.deserialize (JacksonAdapter.java:137)
at com.microsoft.azure.management.resources.fluentcore.utils.ProviderRegistrationInterceptor.intercept (ProviderRegistrationInterceptor.java:47)
at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:121)
at com.microsoft.rest.interceptors.BaseUrlHandler.intercept (BaseUrlHandler.java:43)
at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:121)
at com.microsoft.rest.interceptors.RequestIdHeaderInterceptor.intercept (RequestIdHeaderInterceptor.java:29)
at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain (RealCall.java:200)
at okhttp3.RealCall.execute (RealCall.java:77)
at retrofit2.OkHttpCall.execute (OkHttpCall.java:180)
at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call (CallExecuteOnSubscribe.java:40)
at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call (CallExecuteOnSubscribe.java:24)
at rx.Observable.unsafeSubscribe (Observable.java:10327)
at rx.internal.operators.OnSubscribeMap.call (OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call (OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe (Observable.java:10327)
at rx.internal.operators.OnSubscribeSingle.call (OnSubscribeSingle.java:81)
at rx.internal.operators.OnSubscribeSingle.call (OnSubscribeSingle.java:27)
at rx.internal.operators.SingleToObservable.call (SingleToObservable.java:39)
at rx.internal.operators.SingleToObservable.call (SingleToObservable.java:27)
at rx.Observable.unsafeSubscribe (Observable.java:10327)
at rx.internal.operators.OnSubscribeMap.call (OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call (OnSubscribeMap.java:33)
at rx.internal.operators.OnSubscribeLift.call (OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call (OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe (Observable.java:10327)
at rx.internal.operators.DeferredScalarSubscriber.subscribeTo (DeferredScalarSubscriber.java:153)
at rx.internal.operators.OnSubscribeTakeLastOne.call (OnSubscribeTakeLastOne.java:32)
at rx.internal.operators.OnSubscribeTakeLastOne.call (OnSubscribeTakeLastOne.java:22)
at rx.internal.operators.OnSubscribeLift.call (OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call (OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe (Observable.java:10327)
at rx.internal.operators.OnSubscribeMap.call (OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call (OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe (Observable.java:10327)
at rx.internal.operators.OnSubscribeMap.call (OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call (OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe (Observable.java:10327)
at rx.internal.operators.OnSubscribeMap.call (OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call (OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe (Observable.java:10327)
at rx.internal.operators.OnSubscribeMap.call (OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call (OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe (Observable.java:10327)
at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.call (OperatorSubscribeOn.java:100)
at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call (CachedThreadScheduler.java:230)
at rx.internal.schedulers.ScheduledAction.run (ScheduledAction.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201 (ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)

Steps to reproduce the problem

  1. On a given subscription, Define Policy Definition TLS 1.2 deny. - you can use instructions from https://cmatskas.com/enforcing-tls-version-on-azure-webapps-with-resource-manager-policies/

  2. Use the sample java azure functions documented from https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-java-maven

  3. Using Azure CLI - > MVN Build and deploy - You should get the error policy error mentioned in the trace.

@Flanker32
Copy link
Member

Flanker32 commented Nov 5, 2019

Maven plugin uses fluent sdk(azure-library-for-java) to create resources and update configuration, however, fluent sdk didn't support config minTLS version when create an appservice, tracking here

@dburtman
Copy link

dburtman commented Apr 8, 2020

We've encountered same error on trying to resize a VM. A compliance policy kicked in and that led to this bizarre error. Unrecognized field "evaluationDetails". Why is it "unrecognized"?

This is the full error with stack trace:

2020-04-04 12:01:57,270 ERROR [azure-action-9223304685952541024] [VMRightSizeActionExecutor] : Resize Azure VM azure::VM::f8cc3405-253e-4c08-8675-834d9443018d/auditlogsturbo action failed.
java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "evaluationDetails" (class com.microsoft.azure.PolicyViolationErrorInfo), not marked as ignorable (13 known properties: "policyDefinitionId", "policyDefinitionReferenceId", "policyDefinitionDisplayName", "policyAssignmentParameters", "policyAssignmentName", "policySetDefinitionName", "policyDefinitionName", "policyAssignmentScope", "policyDefinitionEffect", "policyAssignmentId", "policySetDefinitionId", "policySetDefinitionDisplayName", "policyAssignmentDisplayName"])
at [Source: (String)"{"policyDefinitionDisplayName":"Restrict Resources creation based on locations","evaluationDetails":{"evaluatedExpressions":[{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Compute/virtualMachines","targetValue":["microsoft.storage/storageaccounts","Microsoft.Compute/virtualMachines","Microsoft.Compute/virtualMachineScaleSets"],"operator":"In"},{"result":"True","expressionKind":"Field","expression":"location","path":"location","expressionV"[truncated 1048 chars]; line: 1, column: 102] (through reference chain: com.microsoft.azure.CloudError["additionalInfo"]->java.util.ArrayList[0]->com.microsoft.azure.PolicyViolationErrorInfo["evaluationDetails"])
at rx.exceptions.Exceptions.propagate(Exceptions.java:57) ~[rxjava-1.3.8.jar:1.3.8]
at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:463) ~[rxjava-1.3.8.jar:1.3.8]
at rx.observables.BlockingObservable.last(BlockingObservable.java:226) ~[rxjava-1.3.8.jar:1.3.8]
at com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl.apply(CreatableUpdatableImpl.java:256) ~[azure-mgmt-resources-1.21.0.jar:1.21.0]
at com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl.apply(CreatableUpdatableImpl.java:33) ~[azure-mgmt-resources-1.21.0.jar:1.21.0]
at com.vmturbo.mediation.azure.control.AzureVMActions.vmResize(AzureVMActions.java:64) ~[com.vmturbo.mediation.azure-6.4.14.jar:?]
at com.vmturbo.mediation.azure.control.VMRightSizeActionExecutor$VmRightsizeTask.vmRightsize(VMRightSizeActionExecutor.java:372) ~[com.vmturbo.mediation.azure-6.4.14.jar:?]
at com.vmturbo.mediation.azure.control.VMRightSizeActionExecutor$VmRightsizeTask.access$000(VMRightSizeActionExecutor.java:340) ~[com.vmturbo.mediation.azure-6.4.14.jar:?]
at com.vmturbo.mediation.azure.control.VMRightSizeActionExecutor$VmRightsizeTask$1.call(VMRightSizeActionExecutor.java:349) ~[com.vmturbo.mediation.azure-6.4.14.jar:?]
at com.vmturbo.mediation.azure.control.VMRightSizeActionExecutor$VmRightsizeTask$1.call(VMRightSizeActionExecutor.java:346) ~[com.vmturbo.mediation.azure-6.4.14.jar:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_242]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_242]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_242]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "evaluationDetails" (class com.microsoft.azure.PolicyViolationErrorInfo), not marked as ignorable (13 known properties: "policyDefinitionId", "policyDefinitionReferenceId", "policyDefinitionDisplayName", "policyAssignmentParameters", "policyAssignmentName", "policySetDefinitionName", "policyDefinitionName", "policyAssignmentScope", "policyDefinitionEffect", "policyAssignmentId", "policySetDefinitionId", "policySetDefinitionDisplayName", "policyAssignmentDisplayName"])
at [Source: (String)"{"policyDefinitionDisplayName":"Restrict Resources creation based on locations","evaluationDetails":{"evaluatedExpressions":[{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Compute/virtualMachines","targetValue":["microsoft.storage/storageaccounts","Microsoft.Compute/virtualMachines","Microsoft.Compute/virtualMachineScaleSets"],"operator":"In"},{"result":"True","expressionKind":"Field","expression":"location","path":"location","expressionV"[truncated 1048 chars]; line: 1, column: 102] (through reference chain: com.microsoft.azure.CloudError["additionalInfo"]->java.util.ArrayList[0]->com.microsoft.azure.PolicyViolationErrorInfo["evaluationDetails"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:840) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1179) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1592) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1570) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:294) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4202) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3205) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3173) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.microsoft.azure.PolicyViolation.(PolicyViolation.java:38) ~[azure-client-runtime-1.6.4.jar:?]
at com.microsoft.azure.serializer.TypedErrorInfoDeserializer.deserialize(TypedErrorInfoDeserializer.java:61) ~[azure-client-runtime-1.6.4.jar:?]
at com.microsoft.azure.serializer.TypedErrorInfoDeserializer.deserialize(TypedErrorInfoDeserializer.java:24) ~[azure-client-runtime-1.6.4.jar:?]
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:4173) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2467) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.core.JsonParser.readValueAs(JsonParser.java:1765) ~[jackson-core-2.10.0.jar:2.10.0]
at com.microsoft.azure.serializer.CloudErrorDeserializer.deserialize(CloudErrorDeserializer.java:63) ~[azure-client-runtime-1.6.4.jar:?]
at com.microsoft.azure.serializer.CloudErrorDeserializer.deserialize(CloudErrorDeserializer.java:24) ~[azure-client-runtime-1.6.4.jar:?]
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4202) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3205) ~[jackson-databind-2.10.0.jar:2.10.0]
at com.microsoft.rest.serializer.JacksonAdapter.deserialize(JacksonAdapter.java:137) ~[client-runtime-1.6.4.jar:?]
at com.microsoft.azure.management.resources.fluentcore.utils.ProviderRegistrationInterceptor.intercept(ProviderRegistrationInterceptor.java:47) ~[azure-mgmt-resources-1.21.0.jar:1.21.0]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[okhttp-3.11.0.jar:?]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) ~[okhttp-3.11.0.jar:?]
at com.microsoft.rest.interceptors.BaseUrlHandler.intercept(BaseUrlHandler.java:43) ~[client-runtime-1.6.4.jar:?]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[okhttp-3.11.0.jar:?]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) ~[okhttp-3.11.0.jar:?]
at com.microsoft.rest.interceptors.RequestIdHeaderInterceptor.intercept(RequestIdHeaderInterceptor.java:29) ~[client-runtime-1.6.4.jar:?]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[okhttp-3.11.0.jar:?]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) ~[okhttp-3.11.0.jar:?]
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200) ~[okhttp-3.11.0.jar:?]
at okhttp3.RealCall.execute(RealCall.java:77) ~[okhttp-3.11.0.jar:?]
at retrofit2.OkHttpCall.execute(OkHttpCall.java:180) ~[retrofit-2.4.0.jar:?]
at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:40) ~[adapter-rxjava-2.4.0.jar:?]
at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:24) ~[adapter-rxjava-2.4.0.jar:?]
at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33) ~[rxjava-1.3.8.jar:1.3.8]
at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeSingle.call(OnSubscribeSingle.java:81) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeSingle.call(OnSubscribeSingle.java:27) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.SingleToObservable.call(SingleToObservable.java:39) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.SingleToObservable.call(SingleToObservable.java:27) ~[rxjava-1.3.8.jar:1.3.8]
at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.3.8.jar:1.3.8]
at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.DeferredScalarSubscriber.subscribeTo(DeferredScalarSubscriber.java:153) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeTakeLastOne.call(OnSubscribeTakeLastOne.java:32) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeTakeLastOne.call(OnSubscribeTakeLastOne.java:22) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.3.8.jar:1.3.8]
at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33) ~[rxjava-1.3.8.jar:1.3.8]
at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33) ~[rxjava-1.3.8.jar:1.3.8]
at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33) ~[rxjava-1.3.8.jar:1.3.8]
at rx.Observable.unsafeSubscribe(Observable.java:10327) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.call(OperatorSubscribeOn.java:100) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:230) ~[rxjava-1.3.8.jar:1.3.8]
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55) ~[rxjava-1.3.8.jar:1.3.8]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_242]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_242]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_242]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_242]
... 3 more

The full Azure id of the VM in question:
/subscriptions/651dc311-f9a9-4f1b-a5e5-a5bb1ce7a015/resourceGroups/SOA01/providers/Microsoft.Compute/virtualMachines/auditlogsturbo.

This looks like a bug in Azure Java SDK. Is there a timeline/ETA for the fix?
Thank you.

@cspring86
Copy link

@Flanker32 @wangmingliang-ms any update on this?

We're hitting the same policy issue when attempting to deploy to one of our landing zones.

Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.36.0:deploy (default-cli) on project qcep-webhook-invocation: deploy to Function App with resource creation or updating: AzureToolkitRuntimeException: 
Failed to create or update function app : {"error":{"code":"AppendPoliciesFieldsExist","message":"Policies attempted to append some fields which already exist in the request with different values. Fields: 'Microsoft.Web/sites/httpsOnly'. 
Policy identifiers:'[{\"policyAssignment\":{\"name\":\"Deny or Deploy and append TLS requirements and SSL enforcement on resources without Encryption in transit\",\"id\":\"/providers/Microsoft.Management/managementGroups/alz-landingzones/providers/Microsoft.Authorization/policyAssignments/Enforce-TLS-SSL-H224\"},\"policyDefinition\":{\"name\":\"AppService append enable https only setting to enforce https setting.\",\"id\":\"/providers/Microsoft.Management/managementGroups/alz/providers/Microsoft.Authorization/policyDefinitions/Append-AppService-httpsonly\",\"version\":\"1.0.0\"},\"policySetDefinition\":{\"name\":\"Deny or Deploy and append TLS requirements and SSL enforcement on resources without Encryption in transit\",\"id\":\"/providers/Microsoft.Management/managementGroups/alz/providers/Microsoft.Authorization/policySetDefinitions/Enforce-EncryptTransit_20240509\",\"version\":\"1.0.0\"},\"policyDefinitionReferenceId\":\"AppServiceHttpEffect\"}]'. Please contact the subscription administrator to update the policies.","additionalInfo":[{"type":"PolicyViolation","info":{"policyDefinitionId":"/providers/Microsoft.Management/managementGroups/alz/providers/Microsoft.Authorization/policyDefinitions/Append-AppService-httpsonly","policySetDefinitionId":"/providers/Microsoft.Management/managementGroups/alz/providers/Microsoft.Authorization/policySetDefinitions/Enforce-EncryptTransit_20240509","policyDefinitionReferenceId":"AppServiceHttpEffect","policySetDefinitionName":"Enforce-EncryptTransit_20240509","policySetDefinitionDisplayName":"Deny or Deploy and append TLS requirements and SSL enforcement on resources without Encryption in transit","policySetDefinitionVersion":"1.0.0","policyDefinitionName":"Append-AppService-httpsonly","policyDefinitionDisplayName":"AppService append enable https only setting to enforce https setting.","policyDefinitionVersion":"1.0.0","policySetDefinitionCategory":"Encryption","policyDefinitionEffect":"Append","policyDefinitionReferenceGroupNames":[],"policyAssignmentId":"/providers/Microsoft.Management/managementGroups/alz-landingzones/providers/Microsoft.Authorization/policyAssignments/Enforce-TLS-SSL-H224","policyAssignmentName":"Enforce-TLS-SSL-H224","policyAssignmentDisplayName":"Deny or Deploy and append TLS requirements and SSL enforcement on resources without Encryption in transit","policyAssignmentScope":"/providers/Microsoft.Management/managementGroups/alz-landingzones","policyAssignmentParameters":{},"policyAssignmentEnforcementMode":"Default","policyExemptionIds":[],"isPolicyEffectOverridden":false,"isDefinitionVersionOverridden":false}}]}} -> [Help 1]

I can't see anywhere in the configuration where we can enforce HTTPS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants