We should rename all connect commands (like spo connect, graph connect, etc.) to login (spo login, graph login), to clearer indicate that the command is meant to obtain an access token rather than establish a working context.
The currently used connect name is particularly confusing when working with SharePoint commands. If you've worked with CSOM or PnP PowerShell, you know that before performing an operation on a site you have to connect to that particular site. Everything you do afterwards, will assume the context of the site to which you connected.
This isn't the case with the CLI, where you can connect once and operate on any site in your tenant you want. Connecting to a service means obtaining an access token. Because you don't need a different access token for each site, there is no need to reconnect. In each command that operates on site-scoped resources, you specify the URL of the site through its arguments.
@andrewconnell and I realized this when discussing some commands in the CLI and how they operate on the different resources. We came to the conclusion that changing the name from connect to login would make it clearer that you only need to sign in once and unless you want to communicate with a different tenant, you can work with any site without reconnecting.
To prevent a breaking change, we wouldn't remove the connect command but would show a deprecation warning suggesting using the login command instead. The internal working of the command would remain as-is. For consistency, we'd also introduce a logout command which would be a counterpart to disconnect.
What do you think? @VelinGeorgiev @rfjschouten @RARomano @mpowney @wictorwilen
We should rename all
connectcommands (likespo connect,graph connect, etc.) tologin(spo login,graph login), to clearer indicate that the command is meant to obtain an access token rather than establish a working context.The currently used
connectname is particularly confusing when working with SharePoint commands. If you've worked with CSOM or PnP PowerShell, you know that before performing an operation on a site you have to connect to that particular site. Everything you do afterwards, will assume the context of the site to which you connected.This isn't the case with the CLI, where you can connect once and operate on any site in your tenant you want. Connecting to a service means obtaining an access token. Because you don't need a different access token for each site, there is no need to reconnect. In each command that operates on site-scoped resources, you specify the URL of the site through its arguments.
@andrewconnell and I realized this when discussing some commands in the CLI and how they operate on the different resources. We came to the conclusion that changing the name from
connecttologinwould make it clearer that you only need to sign in once and unless you want to communicate with a different tenant, you can work with any site without reconnecting.To prevent a breaking change, we wouldn't remove the
connectcommand but would show a deprecation warning suggesting using thelogincommand instead. The internal working of the command would remain as-is. For consistency, we'd also introduce alogoutcommand which would be a counterpart todisconnect.What do you think? @VelinGeorgiev @rfjschouten @RARomano @mpowney @wictorwilen