PowerPlatformEnvironment Class

Class representing the Power Platform Environment.

Constructor

PowerPlatformEnvironment()

Methods

__init__
__new__
create_uri

Creates the PowerPlatform API connection URL for the given settings. This is a compatibility method that calls _create_uri_standard.

get_copilot_studio_connection_url

Gets the Power Platform API connection URL for the given settings.

get_endpoint_suffix
get_environment_endpoint
get_id_suffix_length
get_token_audience

Returns the Power Platform API Audience.

__init__

__init__()

__new__

__new__(**kwargs)

create_uri

Creates the PowerPlatform API connection URL for the given settings. This is a compatibility method that calls _create_uri_standard.

static create_uri(agent_identifier: str, host: str, agent_type: AgentType, conversation_id: str | None, create_subscribe_link: bool = False) -> str

Parameters

Name Description
agent_identifier
Required
str

The agent/bot identifier

host
Required
str

The host address

agent_type
Required

Type of agent (Published or Prebuilt)

conversation_id
Required
str | None

Optional conversation ID

create_subscribe_link

Whether to create a subscribe link

Default value: False

Returns

Type Description
str

Connection URL string

get_copilot_studio_connection_url

Gets the Power Platform API connection URL for the given settings.

static get_copilot_studio_connection_url(settings: ConnectionSettings, conversation_id: str | None = None, agent_type: AgentType = AgentType.PUBLISHED, cloud: PowerPlatformCloud = PowerPlatformCloud.PROD, create_subscribe_link: bool = False, cloud_base_address: str | None = None, direct_connect_url: str | None = None) -> str

Parameters

Name Description
settings
Required

Configuration Settings to use

conversation_id
str | None

Optional, Conversation ID to address

Default value: None
agent_type

Type of Agent being addressed

Default value: AgentType.PUBLISHED
cloud

Power Platform Cloud Hosting Agent

Default value: PowerPlatformCloud.PROD
create_subscribe_link

Whether to create a subscribe link for the conversation

Default value: False
cloud_base_address
str | None

Power Platform API endpoint to use if Cloud is configured as "other"

Default value: None
direct_connect_url
str | None

DirectConnection URL to a given Copilot Studio agent, if provided all other settings are ignored

Default value: None

Returns

Type Description
str

Connection URL string

get_endpoint_suffix

static get_endpoint_suffix(cloud: PowerPlatformCloud, cloud_base_address: str) -> str

Parameters

Name Description
cloud
Required
cloud_base_address
Required
str

Returns

Type Description
str

get_environment_endpoint

static get_environment_endpoint(cloud: PowerPlatformCloud, environment_id: str, cloud_base_address: str | None = None) -> str

Parameters

Name Description
cloud
Required
environment_id
Required
str
cloud_base_address
str | None
Default value: None

Returns

Type Description
str

get_id_suffix_length

static get_id_suffix_length(cloud: PowerPlatformCloud) -> int

Parameters

Name Description
cloud
Required

Returns

Type Description
int

get_token_audience

Returns the Power Platform API Audience.

static get_token_audience(settings: ConnectionSettings | None = None, cloud: PowerPlatformCloud = PowerPlatformCloud.UNKNOWN, cloud_base_address: str | None = None, direct_connect_url: str | None = None) -> str

Parameters

Name Description
settings

Configuration Settings to use

Default value: None
cloud

Power Platform Cloud Hosting Agent

Default value: PowerPlatformCloud.UNKNOWN
cloud_base_address
str | None

Power Platform API endpoint to use if Cloud is configured as "other"

Default value: None
direct_connect_url
str | None

DirectConnection URL to a given Copilot Studio agent

Default value: None

Returns

Type Description
str

Token audience string

Attributes

API_VERSION

API_VERSION = '2022-03-01-preview'