PowerApps-Samples icon indicating copy to clipboard operation
PowerApps-Samples copied to clipboard

No Enterprise Policy found when running NewIdentity.ps1

Open synGlo opened this issue 2 years ago • 3 comments

I'm trying to run through the common.zip scripts following this setup:

Use managed identities for Azure with your Azure data lake storage https://learn.microsoft.com/en-us/power-apps/maker/data-platform/azure-synapse-link-msi

It creates the policy fine and I can see it in the Resource Graph Explorer using the query: resources | where type == 'microsoft.powerplatform/enterprisepolicies'

But when I come to run the NewIdentity.ps1 script I receive an error, it cannot find the policy:

Linking of identity policy did not start for environement *redacted* Error: { "StatusCode": 404, "StatusDescription": "Not Found", "Headers": [ "Connection", "Strict-Transport-Security", "x-ms-islandgateway", "x-ms-request-id", "x-ms-correlation-request-id", "x-ms-correlation-id", "Server-Timing", "X-Content-Type-Options", "x-ms-service-request-id", "x-ms-activity-vector", "x-azure-ref", "X-Cache", "Content-Length", "Cache-Control", "Content-Type", "Date" ], "Error": { "code": "EnterprisePolicyCallFailed", "message": "The call to a dependent service failed. HttpStatusCode: \u0027NotFound\u0027 Error: \u0027{\"error\":{\"namespace\":\"Quartz.ItemNotFound\",\"code\":\"ItemNotFound\",\"message\":\"Not able to get e nterprise policy for policy id: db677f99-4653-4e94-96f1-7d71068b5764, tenant id: *redacted*. Policy not found.\"}}\u0027", "details": [ "@{code=ItemNotFound; message=Not able to get enterprise policy for policy id: db677f99-4653-4e94-96f1-7d71068b5764, tenant id: *redacted*. Policy not found.}" ] }, "Message": "The call to a dependent service failed. HttpStatusCode: \u0027NotFound\u0027 Error: \u0027{\"error\":{\"namespace\":\"Quartz.ItemNotFound\",\"code\":\"ItemNotFound\",\"message\":\"Not able to get enterprise poli cy for policy id: db677f99-4653-4e94-96f1-7d71068b5764, tenant id: *redacted*. Policy not found.\"}}\u0027", "Internal": {

The Policy Resource ID is correct, when I use Get-AzResource, it returns the correct policy.

synGlo avatar Sep 07 '23 13:09 synGlo

@synGlo We do not provide support here but accept sample code feedback or bug reports. I have notified the article author of your issue.

phecke avatar Sep 15 '23 23:09 phecke

I'm having a very similar issue when following this guide: https://github.com/microsoft/PowerApps-Samples/tree/master/powershell/enterprisePolicies#7-set-subnet-injection-for-an-environment

My Network Injection Policy is visible in the Resource Group (when hidden types are enabled) and has the same ID as reported by the .\NewSubnetInjection.ps1 script that produces the error:

"Error": { "code": "EnterprisePolicyCallFailed", "message": "The call to a dependent service failed. HttpStatusCode: \u0027NotFound\u0027 Error: \u0027{\"error\":{\"namespace\":\"Quartz.ItemNotFound\",\"code\":\"ItemNotFound\",\"message\":\"Not able to get enterprise policy for policy id: c4ecd306-558e-4ed9-8036-a12fcd825a8d, tenant id: XXXX. Policy not found.\"}}\u0027", "details": [ "@{code=ItemNotFound; message=Not able to get enterprise policy for policy id: c4ecd306-558e-4ed9-8036-a12fcd825a8d, tenant id: XXXX. Policy not found.; detailUrlType=NotSpecified}" ], "detailUrlType": "NotSpecified" }

I tried running the script several times with more than two hours passing from creating the network injection.

bandlor avatar May 08 '24 13:05 bandlor

Dear all,

@bandlor @synGlo @phecke

I just wanted to write here because I've been dealing with it for a day long and saw you also had the same issue.

The problem with this error is

Region you set in Azure Enterprise Policy must match the list of Power Platform locations not the Azure Regions.

For instance, If you create the Enterprise Policy in UK but your Power Platform instance is in Europe, you have no chance, it'll constantly fail like this.

You can get the Power Platform lists by using az commands and the current list as of now is like below Command: az provider show -n Microsoft.PowerPlatform --query "resourceTypes[?resourceType=='enterprisePolicies'].locations | [0]" | ConvertFrom-JSon

Result: United States South Africa UK Japan India France Europe Germany Switzerland Canada Brazil Australia Asia UAE Korea Norway Singapore Sweden

work-flower avatar May 21 '24 12:05 work-flower