cli-microsoft365 icon indicating copy to clipboard operation
cli-microsoft365 copied to clipboard

New command: m365 pp website webrole remove

Open appieschot opened this issue 1 year ago • 7 comments

Usage

m365 pp website webrole remove [options]

Description

Removes the specified webrole

Options

Option Description
-i, --id <id> ID of the webrole to remove.
--websiteId [websiteId] ID of the Power Pages website. Specify either websiteId or websiteName but not both.
--websiteName [websiteName] The unique name (not the display name) of the Power Pages website. Specify either websiteId or websiteName but not both.
-e, --environmentName <environmentName> The name of the environment where the web role is located.
--asAdmin Run the command as admin and retrieve Power Pages websites for environments you do not have explicitly assigned permissions to.
-f, --force Don't prompt for confirmation

Examples

Deletes webrole 2ca3eaa5-140f-4175-8261-3272edf9f339 from Power Pages website Contoso-Demo in the given environment.

m365 pp website webrole remove --id "2ca3eaa5-140f-4175-8261-3272edf9f339" --websiteName Contoso-Demo --environmentName "Default-2ca3eaa5-140f-4175-8261-3272edf9f339"

Deletes a webrole from the selected Power Pages website in the given environment without confirmation prompt.

m365 pp website webrole remove --id "2ca3eaa5-140f-4175-8261-3272edf9f339" --websiteId 2ca3eaa5-140f-4175-8261-3272edf9f339 --environmentName "Default-2ca3eaa5-140f-4175-8261-3272edf9f339" --force

Additional Info

More details here: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/reference/entities/mspp_webrole. In this case the API call would be a DELETE request to ${dynamicsApiUrl}/api/data/v9.2/mspp_webroles(webroleid)

appieschot avatar Sep 10 '24 06:09 appieschot

@appieschot awesome job 👏 Here I some things I noticed:

  • in the id option description you have "Specify either id or name but not both." but we do not have an name option 🤔.
  • in description of websiteId and websiteName you refer to webName but it should be websiteName right?
  • the description of the environmentName we could correct to: "The name of the environment where the web role is located."

Adam-it avatar Sep 10 '24 09:09 Adam-it

See, i should copy paste less, thanks for the review, have updated the specs 🙏

appieschot avatar Sep 11 '24 08:09 appieschot

May I take this up1

ktskumar avatar Sep 22 '24 03:09 ktskumar

The ID option should be required, no?

milanholemans avatar Sep 30 '24 07:09 milanholemans

Yes, sharp. Updated the specs! I blame the weather for screwing this one up :D

appieschot avatar Sep 30 '24 07:09 appieschot

${dynamicsApiUrl}/api/data/v9.2/mspp_webroles(webroleid) does not require a websiteId or websiteName as input. To delete a web role, only the webroleId is necessary. Am i missing anything regarding the API? or Should we remove the websiteid and websitename parameters from this command? Please suggest.

ktskumar avatar Oct 01 '24 00:10 ktskumar

@ktskumar You are right, the API call itself does not require the property. The websiteid property is part of the object (mssp_websiteid) but the reasoning was that a user using the UI typically would navigate to a website to delete the role. When speccing the commend that felt like the appropriate way to do for this command as well.

(I could envision a future release where we update this command to even support deleting webroles by name instead of by ID). My vote is to keep it.

appieschot avatar Oct 01 '24 05:10 appieschot