microsoft / coe-starter-kit

Other
721 stars 212 forks source link

[CoE Starter Kit - QUESTION] Environments not being deleted? #8014

Closed Forum-123 closed 2 months ago

Forum-123 commented 2 months ago

Does this question already exist in our backlog?

What is your question?

Hi,

I have recently updated the CoE with the March 2024 updates. I have noticed that the number of some components, like Environments, are being shown incorrectly. We see 131 active environments in the CoE, but we have about 100 environments.

We have only excluded the 4 environments that are configured with the CoE from the Inactivity Flows, Compliance Flow, and App Quarantine Flow.

Thanks in advance

What solution are you experiencing the issue with?

Core

What solution version are you using?

March 2024

What app or flow are you having the issue with?

No response

What method are you using to get inventory and telemetry?

Cloud flows

AB#2840

Jenefer-Monroe commented 2 months ago

Deleting of objects happens in the following flow : CLEANUP - Admin | Sync Template v4 (Check Deleted) The flow is long running and so only runs weekly. Can you please go run it and then see if you see the deleted objects removed (or marked deleted depending on the view you are using)

Forum-123 commented 2 months ago

Thanks for your response. Actually, the CLEANUP - Admin | Sync Template v4 (Check Deleted) flow is currently running and has been running for the last 24 hours.

There are some environments marked to be deleted but that is on top of the 130+ environments, which is the Active environments list, that seems to contain environments that have been deleted a few months ago.

Jenefer-Monroe commented 2 months ago

Sorry I'm not following you. Let's wait till the flow completes and then see what state we are in.

Forum-123 commented 2 months ago

Sorry, let me rephrase.

The CLEANUP - Admin | Sync Template v4 (Check Deleted) flow is currently running. If I go to the 'Check Deleted Scope' and then 'Deleted Environments' scope, I can see about 20 environments have been marked to be deleted. So the 'Environment Deleted' column is set to Yes for these records.

Within the 130+ environments for which 'Environment Deleted' field is set as No, there are 100 or so environments that I would expect to appear in the list. But there are also environments that have been deleted from the tenant (potentially months ago) that are still in this list. I was wondering why these are not being picked up in the flow to be deleted.

Hope this makes sense.

Jenefer-Monroe commented 2 months ago

Sounds like you are experiencing both of these cases:

Deleted from Tenant but not Marked Deleted in inventory.

Find an envt where you expect to see it marked deleted but dont (one which was deleted months ago ideally to avoid timing issues) Go to the most recent run of CLEANUP - Admin | Sync Template v4 (Check Deleted)

  1. Is it present in the output here? image
  2. Is it present in the output here? image

Marked Deleted in Inventory but still present in the Tenant

Then find an environment which still exists in the Tenant but which is marked deleted in inventory Go to the most recent run of Admin | Sync Template v4 (Driver) Is it present in the output here? image If so, find its index in the array and find it in this loop. Where does it go in this condition? image

Forum-123 commented 2 months ago

Thanks. I think we are facing the first issue as the environment has been deleted from the tenant, but it is still present in the CoE. All of the environments that have been marked to be deleted, have in fact been deleted from the tenant (so this is correct).

Below are the findings from the first set of two points you have mentioned:

  1. Deleted environment in tenant is present in this output.
  2. It is not present in this array.
Jenefer-Monroe commented 2 months ago

OK, if the envt is still present in this output, then the product is saying that it still exists. image

What makes you think its been deleted?

Forum-123 commented 2 months ago

The output of the 'Get Environments' action contains the following information in the environment's object and no one is able to find the environment in their list of environments on PPAC: image

But regarding the other environments that seemed to be deleted, but are still present in the inventory - it appears that these are MS Teams environments or environments with no Dataverse linked 🤦🏼 So the account can see these environments, that do exist, in PPAC but just not in its Power Apps list of environments. So this is correct - apologies for spending so much time on this.

Jenefer-Monroe commented 2 months ago

No problem, we are here to help! I learn something new all the time with this communities help.

For example, I've never seen this "provisioningState: Deleted" in that return before! Can you please let me know, if you run it again does it return again? Or was it just a one off timing where it returned something it was in the process of deleting.

Forum-123 commented 2 months ago

All of the other environments have "provisioningState": "Succeeded". The "Deleted" has appeared in a previous run as well for the same environment. It is also in the output of the 'Get Environments' action in flow Admin | Sync Template v4 (Driver). So I am not sure what has happened there 😕

Jenefer-Monroe commented 2 months ago

It seems like this envt is stuck somehow. If you go to https://admin.powerplatform.microsoft.com/environments > Recently deleted environments, do you see it there? image

Forum-123 commented 2 months ago

Ah, no the environment is also not visible there. Could it have been deleted in another way?

When I try to enter the environment URL that's found in the CoE inventory, I get the error message in Chrome, Edge, and Incognito Mode:

This site can’t provide a secure connection
<ENVIRONMENT_URL> sent an invalid response.
ERR_SSL_PROTOCOL_ERROR
Jenefer-Monroe commented 2 months ago

Do you have the Power Platform Admin Role?

Forum-123 commented 2 months ago

Yes, I am logged in with an account that has the Power Platform Administrator role assigned.

Jenefer-Monroe commented 2 months ago

I'm not sure. Seems like this envt got deleted or removed in a way that the product itself cannot contend with. Can you give me all the information in that output where you see the Deleted state? Just obsure the guids

Forum-123 commented 2 months ago

Sure, here is the object:

{
    "id": "/providers/Microsoft.BusinessAppPlatform/scopes/admin/environments/------------------------------------",
    "type": "Microsoft.BusinessAppPlatform/scopes/environments",
    "location": "unitedkingdom",
    "name": "------------------------------------",
    "properties": {
      "tenantId": "------------------------------------",
      "azureRegion": "ukwest",
      "displayName": "------------------------------------",
      "createdTime": "2021-11-19T10:03:02.8464608Z",
      "createdBy": {
        "id": "SYSTEM",
        "displayName": "SYSTEM",
        "type": "NotSpecified"
      },
      "usedBy": {
        "id": "------------------------------------",
        "type": "User",
        "tenantId": "------------------------------------",
        "userPrincipalName": "------------------------------------"
      },
      "lastModifiedTime": "2023-01-24T09:20:05.6257192Z",
      "provisioningState": "Deleted",
      "provisioningDetails": {
        "message": "Successfully deleted environment.",
        "operations": [
          {
            "name": "DELETE/PROVIDERS/MICROSOFT.POWERAPPS/ENVIRONMENTS/",
            "httpStatus": "OK",
            "code": "Deleted"
          },
          {
            "name": "DELETE/POWERAI/PROVISIONING/SOFT",
            "httpStatus": "OK",
            "code": "Deleted"
          },
          {
            "name": "DELETE/POWERQUERY/ENVIRONMENTS/SOFT",
            "httpStatus": "OK",
            "code": "Deleted"
          },
          {
            "name": "DELETE/NEPTUNE/ENVIRONMENTS/",
            "httpStatus": "OK",
            "code": "Deleted"
          },
          {
            "name": "DELETE/TALENT/API/ENVIRONMENTS/",
            "httpStatus": "NotFound",
            "code": "Deleted"
          },
          {
            "name": "POST/FLOW/API/ENVIRONMENTS/DELETERESOURCES",
            "httpStatus": "OK",
            "code": "Deleted"
          },
          {
            "name": "POST/POWERVIRTUALAGENT/API/ENVIRONMENTS/DELETERESOURCES",
            "httpStatus": "OK",
            "code": "Deleted"
          },
          {
            "name": "POST/CXP/API/ENVIRONMENTS/DELETERESOURCES",
            "httpStatus": "OK",
            "code": "Deleted"
          },
          {
            "name": "DELETE/CRM/ADMIN/API/INSTANCES/",
            "httpStatus": "OK",
            "code": "Deleted"
          }
        ],
        "operationId": "------------------------------------"
      },
      "creationType": "Developer",
      "environmentSku": "Developer",
      "isDefault": false,
      "clientUris": {
        "admin": "https://admin.powerplatform.microsoft.com/environments/environment/------------------------------------/hub",
        "maker": "https://make.powerapps.com/environments/------------------------------------/home"
      },
      "runtimeEndpoints": {
        "microsoft.BusinessAppPlatform": "https://unitedkingdom.api.bap.microsoft.com",
        "microsoft.CommonDataModel": "https://unitedkingdom.api.cds.microsoft.com",
        "microsoft.PowerApps": "https://unitedkingdom.api.powerapps.com",
        "microsoft.PowerAppsAdvisor": "https://unitedkingdom.api.advisor.powerapps.com",
        "microsoft.PowerVirtualAgents": "https://powervamg.uk-il102.gateway.prod.island.powerapps.com",
        "microsoft.ApiManagement": "https://management.UK.azure-apihub.net",
        "microsoft.Flow": "https://unitedkingdom.api.flow.microsoft.com"
      },
      "databaseType": "CommonDataService",
      "linkedEnvironmentMetadata": {
        "resourceId": "------------------------------------",
        "friendlyName": "------------------------------------",
        "uniqueName": "------------------------------------",
        "domainName": "------------",
        "version": "9.2.22014.00130",
        "instanceUrl": "---------------------------------------",
        "instanceApiUrl": "---------------------------------------",
        "baseLanguage": 1033,
        "instanceState": "Inactive",
        "createdTime": "2021-11-19T10:03:13.67Z",
        "backgroundOperationsState": "Enabled",
        "scaleGroup": "----------------",
        "platformSku": "Standard",
        "schemaType": "None"
      },
      "trialScenarioType": "None",
      "retentionPeriod": "P7D",
      "states": {
        "management": {
          "id": "Ready"
        },
        "runtime": {
          "runtimeReasonCode": "NotSpecified",
          "requestedBy": {
            "displayName": "SYSTEM",
            "type": "NotSpecified"
          },
          "id": "Disabled"
        }
      },
      "updateCadence": {
        "id": "Frequent"
      },
      "retentionDetails": {
        "retentionPeriod": "P7D",
        "backupsAvailableFromDateTime": "2024-03-31T14:14:00.0402817Z"
      },
      "protectionStatus": {
        "keyManagedBy": "Microsoft"
      },
      "cluster": {
        "category": "Prod",
        "number": "102",
        "uriSuffix": "uk-il102.gateway.prod.island",
        "geoShortName": "UK",
        "environment": "Prod"
      },
      "connectedGroups": [],
      "lifecycleOperationsEnforcement": {
        "allowedOperations": [
          {
            "type": {
              "id": "Delete"
            }
          },
          {
            "type": {
              "id": "Recover"
            }
          },
          {
            "type": {
              "id": "Enable"
            }
          }
        ],
        "disallowedOperations": [
          {
            "type": {
              "id": "Provision"
            },
            "reason": {
              "message": "Provision cannot be performed because there is no linked CDS instance or the CDS instance version is not supported.",
              "type": "CdsLink"
            }
          },
          {
            "type": {
              "id": "Unlock"
            },
            "reason": {
              "message": "Unlock cannot be performed because there is no linked CDS instance or the CDS instance version is not supported.",
              "type": "CdsLink"
            }
          },
          {
            "type": {
              "id": "Convert"
            },
            "reason": {
              "message": "Convert cannot be performed on environment of type Developer.",
              "type": "EnvironmentSkuType"
            }
          },
          {
            "type": {
              "id": "Promote"
            },
            "reason": {
              "message": "Promote cannot be performed on environment of type Developer.",
              "type": "EnvironmentSkuType"
            }
          },
          {
            "type": {
              "id": "UpdateProtectionStatus"
            },
            "reason": {
              "message": "UpdateProtectionStatus cannot be performed on environment of type Developer.",
              "type": "EnvironmentSkuType"
            }
          },
          {
            "type": {
              "id": "ForceFailover"
            },
            "reason": {
              "message": "ForceFailover cannot be performed on environment of type Developer.",
              "type": "EnvironmentSkuType"
            }
          },
          {
            "type": {
              "id": "Move"
            },
            "reason": {
              "message": "Move cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "Backup"
            },
            "reason": {
              "message": "Backup cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "Copy"
            },
            "reason": {
              "message": "Copy cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "Edit"
            },
            "reason": {
              "message": "Edit cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "Reset"
            },
            "reason": {
              "message": "Reset cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "Restore"
            },
            "reason": {
              "message": "Restore cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "NewCustomerManagedKey"
            },
            "reason": {
              "message": "NewCustomerManagedKey cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "RotateCustomerManagedKey"
            },
            "reason": {
              "message": "RotateCustomerManagedKey cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "RevertToMicrosoftKey"
            },
            "reason": {
              "message": "RevertToMicrosoftKey cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "NewNetworkInjection"
            },
            "reason": {
              "message": "NewNetworkInjection cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "SwapNetworkInjection"
            },
            "reason": {
              "message": "SwapNetworkInjection cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "RevertNetworkInjection"
            },
            "reason": {
              "message": "RevertNetworkInjection cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "NewIdentity"
            },
            "reason": {
              "message": "NewIdentity cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "SwapIdentity"
            },
            "reason": {
              "message": "SwapIdentity cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "RevertIdentity"
            },
            "reason": {
              "message": "RevertIdentity cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "Disable"
            },
            "reason": {
              "message": "Disable cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "EnableGovernanceConfiguration"
            },
            "reason": {
              "message": "EnableGovernanceConfiguration cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "DisableGovernanceConfiguration"
            },
            "reason": {
              "message": "DisableGovernanceConfiguration cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "UpdateGovernanceConfiguration"
            },
            "reason": {
              "message": "UpdateGovernanceConfiguration cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "PrepareTenantToTenant"
            },
            "reason": {
              "message": "PrepareTenantToTenant cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          },
          {
            "type": {
              "id": "MigrateTenantToTenant"
            },
            "reason": {
              "message": "MigrateTenantToTenant cannot be performed on environment because it is disabled.",
              "type": "EnvironmentDisabled"
            }
          }
        ]
      },
      "governanceConfiguration": {
        "protectionLevel": "Basic"
      },
      "bingChatEnabled": true
    }
  }
Jenefer-Monroe commented 2 months ago

Sorry I'm just not getting any clues from this. It appears you have an environment that is stuck in soft deleted but not showing up for you in UX. I've never seen this before so I presume something broke for your somewhere. You may have to contact product support to get this cleaned up. The basic issue to raise to them: Why is this envt showing up in the connector call but not in your UX anywhere.

Forum-123 commented 2 months ago

Ah, okay I will look to raise a support ticket on this issue found.

Thank you for your help on this question. Happy for you to close this as there is no action required.

Jenefer-Monroe commented 2 months ago

I'll hold for a few days in the event you hear back from support. Perhaps they will tell us something that we can do to help others in this case in the future.

Jenefer-Monroe commented 2 months ago

closing out as no further action for starter kit team