Cant publish app to Azure with Visual Studio

Oskar Karlsson 0 Reputation points
2023-03-16T21:42:22.6366667+00:00

I'm trying to follow this tutorial to publish an app to Azure, but during step Publish ASP.NET application to Azure, I'm getting an error when trying to create an appservice. What does this error mean?

I'm currently using my Visual Studio Subscription, but if I remember correctly, I have recieved the same error before when trying to complete another totorial where a sandbox environemt was provided with a temparary sandbox-tutorial subscription.

System.Net.Http.HttpRequestException: {"error":{"code":"RequestDisallowedByPolicy","target":"OskarTest","message":"Resource 'OskarTest' was disallowed by policy. Policy identifiers: '[{\"policyAssignment\":{\"name\":\"Allowed locations for resource groups\",\"id\":\"/providers/Microsoft.Management/managementGroups/f6133d6e-20c4-4c25-b024-3ac43c9d5bcb/providers/Microsoft.Authorization/policyAssignments/3637e5ec43604c02b4b26b97\"},\"policyDefinition\":{\"name\":\"Allowed locations for resource groups\",\"id\":\"/providers/Microsoft.Authorization/policyDefinitions/e765b5de-1225-4ba3-bd56-1ac6695af988\"}}]'.","additionalInfo":[{"type":"PolicyViolation","info":{"evaluationDetails":{"evaluatedExpressions":[{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Resources/subscriptions/resourcegroups","targetValue":"Microsoft.Resources/subscriptions/resourceGroups","operator":"Equals"},{"result":"True","expressionKind":"Field","expression":"location","path":"location","expressionValue":"eastus","targetValue":["northeurope","westeurope","swedencentral"],"operator":"NotIn"}]},"policyDefinitionId":"/providers/Microsoft.Authorization/policyDefinitions/e765b5de-1225-4ba3-bd56-1ac6695af988","policyDefinitionName":"e765b5de-1225-4ba3-bd56-1ac6695af988","policyDefinitionDisplayName":"Allowed locations for resource groups","policyDefinitionEffect":"deny","policyAssignmentId":"/providers/Microsoft.Management/managementGroups/f6133d6e-20c4-4c25-b024-3ac43c9d5bcb/providers/Microsoft.Authorization/policyAssignments/3637e5ec43604c02b4b26b97","policyAssignmentName":"3637e5ec43604c02b4b26b97","policyAssignmentDisplayName":"Allowed locations for resource groups","policyAssignmentScope":"/providers/Microsoft.Management/managementGroups/f6133d6e-20c4-4c25-b024-3ac43c9d5bcb","policyAssignmentParameters":{"listOfAllowedLocations":["northeurope","westeurope","swedencentral"]}}}]}}
   at Microsoft.WebTools.Azure.VS.Provisioning.ResourceProvisioningControlModel.<ThrowOnUnexpectedStatusCodeAsync>d__153.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.WebTools.Azure.Client.Http.HttpResponseExtensions.<DeserializeEntityJsonAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.WebTools.Azure.Client.Navigation.ARMRootExtensions.<DeserializeEntityAsync>d__11`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.WebTools.Azure.Client.Navigation.EntityExtensions.<PutAsync>d__33`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.WebTools.Azure.VS.Provisioning.ResourceProvisioningControlModel.<DeferredDeploymentRunnerAsync>d__155.MoveNext()
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,939 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.