web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / I would like to use Po...
Power Automate
Unanswered

I would like to use PowerShell to assign a connector with settings such as "Business" to the PowerPlatform environment.

(0) ShareShare
ReportReport
Posted on by

As the title says, Create a "non-business" only policy and output the policy to CSV using PowerShell. I want to edit the "Group" column and assign this to an environment. (for only one environment) I will write the script code to be assigned after the image, I don't know what's wrong. By the way, it works if you set it to "AllEnviloments" instead of "SelectedEnviloments". ---------------------------------------------- # 新規作成するポリシーの名前を設定します $newDLPPolicyName = "TEST"   # インポートするCSVのファイルパスを記入してください。 $inputCSVFilePath = "C:\PoewrShell_Policy\PS_TEST\PowerShellポリシー設定TEST用_本番環境_適用対象_20240318_inputs.csv" # 適用する環境のIDを指定します $environmentId = "67d90760-4e81-eb26-b629-9ac101f415bd" $newDLPPolicy = New-DlpPolicy -DisplayName $newDLPPolicyName -EnvironmentType "SelectedEnvironments" -EnvironmentId $environmentId $csv = Import-Csv -Path $inputCSVFilePath -Encoding UTF8 | Select Group, Name, ID, Type $allConnectors = $csv | Group-Object -Property Group $BusinessDataConnectors = $allConnectors | Where-Object { $_.Name -eq "BusinessDataGroup" } $NonBusinessDataConnectors = $allConnectors | Where-Object { $_.Name -eq "NonBusinessDataGroup" } $BlockedConnectors = $allConnectors | Where-Object { $_.Name -eq "BlockedGroup" } # [ビジネス] グループに割り当てるコネクタを定義します。 if($BusinessDataConnectors){     $BusinessDataConnectorsGroup = [PSCustomObject]@{         classification = "Confidential"         connectors     = $BusinessDataConnectors.Group | Select-Object Name, ID, Type     } } else {     $BusinessDataConnectorsGroup = [PSCustomObject]@{         classification = "Confidential"         connectors     = @()     } } # [非ビジネス] グループに割り当てるコネクタを定義します。 if($NonBusinessDataConnectors){     $NonBusinessDataConnectorsGroup = [PSCustomObject]@{         classification = "General"         connectors     = $NonBusinessDataConnectors.Group | Select-Object Name, ID, Type     } } else {     $NonBusinessDataConnectorsGroup = [PSCustomObject]@{         classification = "General"         connectors     = @()     } } # [ブロック] グループに割り当てるコネクタを定義します。 if($BlockedConnectors){     $BlockedConnectorsGroup = [PSCustomObject]@{         classification = "Blocked"         connectors     = $BlockedConnectors.Group | Select-Object Name, ID, Type     } } else {     $BlockedConnectorsGroup = [PSCustomObject]@{         classification = "Blocked"         connectors     = @()     } } $allConnectorGroups = @() $allConnectorGroups += $BlockedConnectorsGroup $allConnectorGroups += $BusinessDataConnectorsGroup $allConnectorGroups += $NonBusinessDataConnectorsGroup $newDLPPolicy.connectorGroups = $allConnectorGroups Set-DlpPolicy -PolicyName $newDLPPolicy.name -UpdatedPolicy $newDLPPolicy ---------------------------------------------- "connectorGroups" の設定中に例外が発生しました: "このオブジェクトにプロパティ 'connectorGroups' が見つかりません。プロパティ が存在し、設定可能であることを確認してください。" 発生場所 C:\PoewrShell_Policy\PS_TEST\TEST.ps1:59 文字:1 + $newDLPPolicy.connectorGroups = $allConnectorGroups + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : NotSpecified: (:) [], SetValueInvocationException     + FullyQualifiedErrorId : ExceptionWhenSetting   Set-DlpPolicy : 引数が空の文字列であるため、パラメーター 'PolicyName' にバインドできません。 発生場所 C:\PoewrShell_Policy\PS_TEST\TEST.ps1:61 文字:27 + Set-DlpPolicy -PolicyName $newDLPPolicy.name -UpdatedPolicy $newDLPPo ... +                           ~~~~~~~~~~~~~~~~~~     + CategoryInfo          : InvalidData: (:) [Set-DlpPolicy]、ParameterBindingValidationException     + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Set-DlpPolicy

Categories:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 315 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 267

#3
Henil Profile Picture

Henil 115

Last 30 days Overall leaderboard