This commit is contained in:
Mahbub Murshed 2022-06-16 14:30:53 -07:00 коммит произвёл GitHub
Родитель 0ba80326a8
Коммит f24fb5a6a9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 41 добавлений и 40 удалений

Просмотреть файл

@ -1,15 +1,14 @@
# Microsoft Power Platform Connectors CLI
**NOTE**
**These release notes describe functionality that may not have been released yet.** To see when this functionality is planned to release, please review [What's new and planned for Common Data Model and Data Integration](https://docs.microsoft.com/en-us/business-applications-release-notes/April19/cdm-data-integration/planned-features). Delivery timelines and projected functionality may change or may not ship (see [Microsoft policy](https://go.microsoft.com/fwlink/p/?linkid=2007332)).
>[Note]
>**These release notes describe functionality that may not have been released yet.** To see when this functionality is planned to release, please review [What's new and planned for Common Data Model and Data Integration](https://docs.microsoft.com/en-us/business-applications-release-notes/April19/cdm-data-integration/planned-features). Delivery timelines and projected functionality may change or may not ship (see [Microsoft policy](https://go.microsoft.com/fwlink/p/?linkid=2007332)).
The `paconn` command line tool is designed to aid Microsoft Power Platform custom connectors development.
The `paconn` command-line tool is designed to aid Microsoft Power Platform custom connectors development.
## Installing
1. Install Python 3.5+ from https://www.python.org/downloads. Click the 'Download' link on any version of Python greater than Python 3.5. For Linux and Mac OS X please follow the appropriate link on the page. You can also install using an OS specific package manager of your choice.
1. Install Python 3.5+ from [https://www.python.org/downloads](Python downloads). Select the 'Download' link on any version of Python greater than Python 3.5. For Linux and macOS X, follow the appropriate link on the page. You can also install using an OS-specific package manager of your choice.
2. Run the installer to begin installation and be sure to check the box 'Add Python X.X to PATH'.
@ -21,21 +20,21 @@ The `paconn` command line tool is designed to aid Microsoft Power Platform custo
`pip install paconn`
If you get errors saying 'Access is denied', consider using the `--user` option or running the command as an Administrator (Windows).
If you get errors saying 'Access is denied', consider using the `--user` option or running the command as an Administrator (Windows).
## Custom Connector Directory and Files
A custom connector consists of three files: An Open API swagger definition, an API properties file, and an optional icon for the connector. The files are generally located in a directory with the connector ID as the name of the directory.
A custom connector consists of two to four files: an Open API swagger definition, an API properties file, an optional icon for the connector, and an optional csharp script file. The files are generally located in a directory with the connector ID as the name of the directory.
Sometimes, the custom connector directory may include a `settings.json` file. Although this file is not part of the connector definition, it can be used as an argument-store for the CLI.
Sometimes, the custom connector directory may include a `settings.json` file. Although this file isn't part of the connector definition, it can be used as an argument-store for the CLI.
### API Definition (Swagger) File
The API definition, also known as the swagger, describes the API for the custom connector using the OpenAPI specification. More information about API definition to write custom connector can be found in [the connector documentation on the subject](https://docs.microsoft.com/en-us/connectors/custom-connectors/define-openapi-definition). Please also review the tutorial on [extending an OpenApi definition](https://docs.microsoft.com/en-us/connectors/custom-connectors/openapi-extensions).
The API definition file describes the API for the custom connector using the OpenAPI specification. It's also known as the swagger file. For more information about API definitions used to write custom connector, go to [Create a custom connector from an OpenAPI definition](https://docs.microsoft.com/en-us/connectors/custom-connectors/define-openapi-definition). Also review the tutorial in the [Extend an OpenAPI definition for a custom connector](https://docs.microsoft.com/en-us/connectors/custom-connectors/openapi-extensions) article.
### API Properties File
The API properties file contains some properties for the custom connector. These properties are not part of the API definition. It contains information such as the brand color, authentication information, etc. A typical API properties file looks like the following:
The API properties file contains some properties for the custom connector. These properties aren't part of the API definition. It contains information such as the brand color, authentication information, and so on. A typical API properties file looks like the following sample:
```json
{
@ -77,7 +76,7 @@ The API properties file contains some properties for the custom connector. These
}
```
More information on the each of the properties are given below:
More information on each of the properties is given below:
* `properties`: The container for the information.
@ -87,13 +86,13 @@ More information on the each of the properties are given below:
* `scriptOperations`: A list of the operations that are executed with the script file. An empty scriptOperations list indicates that all operations are executed with the script file.
* `capabilities`: Describes the capabilities for the connector, e.g. cloud only, on-prem gateway etc.
* `capabilities`: Describes the capabilities for the connector, for example, cloud only, on-prem gateway, and so on.
* `policyTemplateInstances`: An optional list of policy template instances and values used in the custom connector.
### Icon File
The icon is icon image file for the custom connector.
The icon file is a small image representing the custom connector icon.
### Script File
@ -101,7 +100,7 @@ The script is a CSX script file that is deployed for the custom connector and ex
### Settings File
Instead of providing the arguments in the command line, a `settings.json` file can be used to specify them. A typical `settings.json` file looks like the following:
Instead of providing the arguments in the command line, a `settings.json` file can be used to specify them. A typical `settings.json` file looks like the following sample:
```json
{
@ -116,34 +115,33 @@ Instead of providing the arguments in the command line, a `settings.json` file c
}
```
In the settings file the following items are expected. If an option is missing but required, the console will prompt for the missing information.
In the settings file, the following items are expected. If an option is missing but required, the console will prompt for the missing information.
* `connectorId`: The connector ID string for the custom connector. This parameter is required for download and update operations, but not for the create operation since a new custom connector with the new ID will be created. It's also not needed for the validate command. If you need to update a custom connector just created using the same settings file, please make sure the settings file is correctly updated with the new connector ID from the create operation.
* `connectorId`: The connector ID string for the custom connector. This parameter is required for download and update operations, but not for the create or validate operation. A new custom connector with the new ID will be created for create command. If you need to update a custom connector just created using the same settings file, please make sure the settings file is correctly updated with the new connector ID from the create operation.
* `environment`: The environment ID string for the custom connector. This parameter is required for all operations, except the validate operation.
* `apiProperties`: The path to the API properties file. It is required for the create and update operation. When this option is present during the download operation, the file will be downloaded to the given location, otherwise it will be saved as `apiProperties.json`.
* `apiProperties`: The path to the API properties `apiProperties.json` file. It's required for the create and update operation. When this option is present during the download, the file will be downloaded to the given location, otherwise it will be saved as `apiProperties.json`.
* `apiDefinition`: The path to the swagger file. It is required for the create, update, and validate operations. When this option is present during the download operation, the file in the given location will be written to, otherwise it will be saved as `apiDefinition.swagger.json`.
* `apiDefinition`: The path to the swagger file. It's required for the create, update, and validate operations. When this option is present during the download operation, the file in the given location will be written to, otherwise it will be saved as `apiDefinition.swagger.json`.
* `icon`: The path to the optional icon file. The create and update operations will use the default icon when this parameter is no specified. When this option is present during the download operation, the file in the given location will be written to, otherwise it will be saved as `icon.png`.
* `script`: The path to the optional script file. The create and update operations will use only the value within the specified parameter. When this option is present during the download operation, the file in the given location will be written to, otherwise it will be saved as `script.csx`.
* `powerAppsUrl`: The API URL for PowerApps. This is optional and set to `https://api.powerapps.com` by default.
* `powerAppsUrl`: The API URL for Power Apps. This parameter is optional and set to `https://api.powerapps.com` by default.
* `powerAppsApiVersion`: The API version to use for PowerApps. This is optional and set to `2016-11-01` by default.
* `powerAppsApiVersion`: The API version to use for Power Apps. This parameter is optional and set to `2016-11-01` by default.
## Command Line Operations
## Command-Line Operations
### Login
Login to Power Platform by running:
Log in to Power Platform by running:
`paconn login`
This will ask you to login using device code login process. Please follow the prompt for the login. Service Principle authentication is not supported at this point. Please review [a customer workaround posted in the issues page](https://github.com/microsoft/PowerPlatformConnectors/issues/287).
This command will ask you to log in using the device code login process. Follow the prompt for the log in. Service Principle authentication is not supported at this point. Please review [a customer workaround posted in the issues page](https://github.com/microsoft/PowerPlatformConnectors/issues/287).
### Logout
@ -153,7 +151,7 @@ Logout by running:
### Download Custom Connector Files
The connector files are always downloaded into a sub-directory with the connector ID as the directory name. When a destination directory is specified, the sub-directory will be created in the specified one. Otherwise, it will be created in the current directory. In addition to the three connector files, the download operation will also write a fourth file called settings.json containing the parameters used to download the files.
The connector files are always downloaded into a subdirectory with the connector ID as the directory name. When a destination directory is specified, the subdirectory will be created in the specified one. Otherwise, it will be created in the current directory. In addition to the three connector files, the download operation will also write a fourth file called settings.json containing the parameters used to download the files.
Download the custom connector files by running:
@ -161,19 +159,21 @@ Download the custom connector files by running:
or
`paconn download -e [Power Platform Environment ID] -c [Connector ID]`
`paconn download -e [Power Platform Environment GUID] -c [Connector ID]`
or
`paconn download -s [Path to settings.json]`
When environment or connector ID is not specified the command will prompt for the missing argument(s). The command will print the download location for the connector on successful completion.
When the environment or connector ID isn't specified, the command will prompt for the missing argument(s). The command will output the download location for the connector if it successfully downloads.
All the arguments can be also specified using a [settings.json file](#settings-file).
```
Arguments
--cid -c : The custom connector ID.
--dest -d : Destination directory.
--env -e : Power Platform environment ID.
--dest -d : Destination directory.
--env -e : Power Platform environment GUID.
--overwrite -w : Overwrite all the existing connector and settings files.
--pau -u : Power Platform URL.
--pav -v : Power Platform API version.
@ -181,27 +181,28 @@ Arguments
When a settings file is specified some command
line parameters are ignored.
```
### Create a New Custom Connector
A new custom connector can be created from the connectors files using the `create` operation. Create a connector by running:
A new custom connector can be created from the connectors files by running the `create` operation. Create a connector by running:
`paconn create --api-prop [Path to apiProperties.json] --api-def [Path to apiDefinition.swagger.json]`
or
`paconn create -e [Power Platform Environment ID] --api-prop [Path to apiProperties.json] --api-def [Path to apiDefinition.swagger.json] --icon [Path to icon.png] --secret [The OAuth2 client secret for the connector]`
`paconn create -e [Power Platform Environment GUID] --api-prop [Path to apiProperties.json] --api-def [Path to apiDefinition.swagger.json] --icon [Path to icon.png] --secret [The OAuth2 client secret for the connector]`
or
`paconn create -s [Path to settings.json] --secret [The OAuth2 client secret for the connector]`
When environment is not specified the command will prompt for it. However, the API definition and API properties file must be provided as part of the command line argument or a settings file. The OAuth2 secret must be provided for a connector using OAuth2. The command will print the connector ID for the newly created custom connector on successful completion. If you are using a settings file for the create command, please make sure to update it with the new connector ID before you update the newly created connector.
When the environment isn't specified, the command will prompt for it. However, the API definition and API properties file must be provided as part of the command line argument or a settings file. The OAuth2 secret must be provided for a connector using OAuth2. The command will print the connector ID for the newly created custom connector on successful completion. If you're using a settings.json file for the create command, please make sure to update it with the new connector ID before you update the newly created connector.
```
Arguments
--api-def : Location for the Open API definition JSON document.
--api-prop : Location for the API properties JSON document.
--env -e : Power Platform environment ID.
--env -e : Power Platform environment GUID.
--icon : Location for the icon file.
--script -x : Location for the script file.
--pau -u : Power Platform URL.
@ -219,20 +220,20 @@ Like the `create` operation, an existing custom connector can be updated using t
or
`paconn update -e [Power Platform Environment ID] -c [Connector ID] --api-prop [Path to apiProperties.json] --api-def [Path to apiDefinition.swagger.json] --icon [Path to icon.png] --secret [The OAuth2 client secret for the connector]`
`paconn update -e [Power Platform Environment GUID] -c [Connector ID] --api-prop [Path to apiProperties.json] --api-def [Path to apiDefinition.swagger.json] --icon [Path to icon.png] --secret [The OAuth2 client secret for the connector]`
or
`paconn update -s [Path to settings.json] --secret [The OAuth2 client secret for the connector]`
When environment or connector ID is not specified the command will prompt for the missing argument(s). However, the API definition and API properties file must be provided as part of the command line argument or a settings file. The OAuth2 secret must be provided for a connector using OAuth2. The command will print the updated connector ID on successful completion. If you are using a settings file for the update command, please make sure correct environment and connector ID are specified.
When environment or connector ID isn't specified, the command will prompt for the missing argument(s). However, the API definition and API properties file must be provided as part of the command-line argument or a settings file. The OAuth2 secret must be provided for a connector using OAuth2. The command will print the updated connector ID on successful completion. If you're using a settings.json file for the update command, make sure the correct environment and connector ID are specified.
```
Arguments
--api-def : Location for the Open API definition JSON document.
--api-prop : Location for the API properties JSON document.
--cid -c : The custom connector ID.
--env -e : Power Platform environment ID.
--env -e : Power Platform environment GUID.
--icon : Location for the icon file.
--script -x : Location for the script file.
--pau -u : Power Platform URL.
@ -274,7 +275,7 @@ Please test the custom connector and the settings file in a test environment bef
## Limitations
The project is limited to creation, update, and download of custom connector in flow and powerapps environment. When an environment is not specified only the flow envrionments are displayed to choose from. For non-custom connector the swagger file is not returned.
The project is limited to creation, update, and download of a custom connector in the Power Automate and Power Apps environment. When an environment isn't specified, only the Power Automate environments are listed to choose from. For a non-custom connector, the swagger file isn't returned.
**Stack Owner Property & apiProperties file:**
@ -282,9 +283,9 @@ Currently, there is a limitation that prevents you from updating your connector'
## Reporting issues and feedback
If you encounter any bugs with the tool please file an issue in the [Issues](https://github.com/Microsoft/PowerPlatformConnectors/issues) section of our GitHub repo.
If you encounter any bugs with the tool, submit an issue in the [Issues](https://github.com/Microsoft/PowerPlatformConnectors/issues) section of our GitHub repo.
If you believe you have found a security vulnerability that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383%28v=technet.10%29), please submit the [report to MSRC](https://msrc.microsoft.com/create-report). More information can be found at [MSRC frequently asked questions on reporting](https://www.microsoft.com/en-us/msrc/faqs-report-an-issue).
If you believe you have found a security vulnerability that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/previous-versions/tn-archive/cc751383%28v=technet.10%29), submit a [report to MSRC](https://msrc.microsoft.com/create-report). More information can be found at [MSRC frequently asked questions on reporting](https://www.microsoft.com/msrc/faqs-report-an-issue).
## Contributing