cli-microsoft365
cli-microsoft365 copied to clipboard
New command: m365 pp dataverse table list
Usage
m365 pp dataverse table list
Description
Lists dataverse tables in given environment
Options
Option | Description |
---|---|
-e, --environment <environment> |
The name of the environment to list all tables for |
--asAdmin |
Set, to retrieve the dataverse tables as admin for environments you are not a member of |
Examples
List all tables for the given environment
m365 pp dataverse table list -e "Default-2ca3eaa5-140f-4175-8261-3272edf9f339"
List all tables for the given environment as Admin
m365 pp dataverse table list -e "Default-2ca3eaa5-140f-4175-8261-3272edf9f339" --asAdmin
Additional Info
We can retrieve from the runtime endpoints the same way we retrieve the https://europe.api.bap.microsoft.com URL the value for Dynamics and call the following URL to get all details.
We should do a get on the environment details to get the properties that contain the correct url:
"linkedEnvironmentMetadata": {
"instanceUrl": "https://xx.crm4.dynamics.com/",
"instanceApiUrl": "https://xx.api.crm4.dynamics.com",
},
And then call something like:
https://ORGURL/api/data/v9.0/EntityDefinitions?%24select=MetadataId%2CIsCustomEntity%2CSchemaName%2CIconVectorName%2CLogicalName%2CEntitySetName%2CIsActivity%2CDataProviderId%2CIsRenameable%2CIsCustomizable%2CCanCreateForms%2CCanCreateViews%2CCanCreateCharts%2CCanCreateAttributes%2CCanChangeTrackingBeEnabled%2CCanModifyAdditionalSettings%2CCanChangeHierarchicalRelationship%2CCanEnableSyncToExternalSearchIndex&%24filter=(IsIntersect%20eq%20false%20and%20IsLogicalEntity%20eq%20false%20and%0APrimaryNameAttribute%20ne%20null%20and%20PrimaryNameAttribute%20ne%20%27%27%20and%20ObjectTypeCode%20gt%200%20and%0AObjectTypeCode%20ne%204712%20and%20ObjectTypeCode%20ne%204724%20and%20ObjectTypeCode%20ne%209933%20and%20ObjectTypeCode%20ne%209934%20and%0AObjectTypeCode%20ne%209935%20and%20ObjectTypeCode%20ne%209947%20and%20ObjectTypeCode%20ne%209945%20and%20ObjectTypeCode%20ne%209944%20and%0AObjectTypeCode%20ne%209942%20and%20ObjectTypeCode%20ne%209951%20and%20ObjectTypeCode%20ne%202016%20and%20ObjectTypeCode%20ne%209949%20and%0AObjectTypeCode%20ne%209866%20and%20ObjectTypeCode%20ne%209867%20and%20ObjectTypeCode%20ne%209868)%20and%20(IsCustomizable%2FValue%20eq%20true%20or%20IsCustomEntity%20eq%20true%20or%20IsManaged%20eq%20false%20or%20IsMappable%2FValue%20eq%20true%20or%20IsRenameable%2FValue%20eq%20true)&api-version=9.1
All details on https://docs.microsoft.com/en-us/power-apps/developer/data-platform/webapi/query-metadata-web-api
As pointed out by @waldekmastykarz as a list
command the following properties should be part of the output when using text
output: DisplayName (table name), EntitySetName, IsManaged
⚠️ requires additional permissions when going live; needs the Dynamics CRM user_impersonation permissions
@pnp/cli-for-microsoft-365-maintainers please chime in on the command structure. I added the table segment as I can see that the CLI at some point should be able to add new tables as well, and dataverse also provide options to add things like dataflows / synapse links and connectors. If we all agree I can open it up for help or build it ;)
I like it @appieschot, you have my blessing!
Looks good to me. Great suggestion @appieschot!
all in on this one 👍 I also agree on adding more commands for the pp. I think it will be a good time investment since a lot is going on the PP side now and users are probably looking for a good CLI tool which could support it and not only that 😉
Since this is a list command, let's extend the spec to mention which properties we'll show by default in text output
Great feedback! Updated the specs 🦾
Okey minor update, after creating a custom app reg I can confirm that
m365 request --url "https://digiwijs.api.crm4.dynamics.com/api/data/v9.0/EntityDefinitions" --debug
works (requires some filtering / selecting of proper values) and an update to the base pp command class to figure out what the dynamics URL is as that differs per environment. But I do get a response. Suggest that I pick up this one and work out the basics