Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.13k stars 3.77k forks source link

[Az.BotService] Duplicated output issue while calling Get-AzBotService. #20352

Open NoriZC opened 1 year ago

NoriZC commented 1 year ago

Description

If we have several bot services under current subscription whose locations are not the same. When we calling Get-AzBotService to get a list of bot services from current subscription or from a resource group, there will be duplicated outputs. How many times the output repeat depends on how many different locations there are.

Issue script & Debug output

PS> $DebugPreference='Continue'
PS> Get-AzBotService -ResourceGroupName botTest-rg
DEBUG: 9:40:34 PM - GetAzureRMContextCommand end processing.
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/botTest-rg/providers/Microsoft.BotService/botServices?api-version=2022-06-15-preview
DEBUG: RequestCreated: /subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/botTest-rg/providers/Microsoft.BotService/botServices?api-version=2022-06-15-preview
DEBUG: HeaderParametersAdded:
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/botTest-rg/providers/Microsoft.BotService/botServices?api-version=2022-06-15-preview

Headers:
x-ms-unique-id                : 7
x-ms-client-request-id        : a06fc71e-84a7-4731-af73-df503f2b294e
CommandName                   : Get-AzBotService
FullCommandName               : Get-AzBotService_List
ParameterSetName              : __AllParameterSets
User-Agent                    : AzurePowershell/v0.0.0,PSVersion/v7.2.7,Az.BotService/0.1.0

Body:

DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
x-ms-original-request-ids     : 801978b0-cd0b-4647-8e7e-5a64bf281ae1,e38daa96-ee49-4de9-b104-1a7e0656601e
x-ms-ratelimit-remaining-subscription-reads: 11999
x-ms-request-id               : 5fb82771-8b7e-492d-9bc4-28d0f8824b92
x-ms-correlation-request-id   : 5fb82771-8b7e-492d-9bc4-28d0f8824b92
x-ms-routing-request-id       : SOUTHEASTASIA:20221201T134038Z:5fb82771-8b7e-492d-9bc4-28d0f8824b92
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Thu, 01 Dec 2022 13:40:38 GMT

Body:
{
  "value": [
    {
      "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/botTest-rg/providers/Microsoft.BotService/botServices/testBot_global",
      "name": "testBot_global",
      "type": "Microsoft.BotService/botServices",
      "etag": "\"6800b1a5-0000-1800-0000-6388ae5d0000\"",
      "location": "global",
      "sku": {
        "name": "F0"
      },
      "kind": "bot",
      "tags": {},
      "properties": {
        "displayName": "testBot_global",
        "description": null,
        "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png",
        "endpoint": "",
        "msaAppId": "51f84f37-0b28-4e00-9ea6-576e2db57dd2",
        "msaAppTenantId": null,
        "msaAppType": null,
        "msaAppMSIResourceId": null,
        "developerAppInsightKey": null,
        "developerAppInsightsApplicationId": null,
        "luisAppIds": [],
        "endpointVersion": "3.0",
        "configuredChannels": [
          "webchat"
        ],
        "enabledChannels": [
          "webchat",
          "directline"
        ],
        "isDeveloperAppInsightsApiKeySet": false,
        "isStreamingSupported": false,
        "schemaTransformationVersion": "1.3",
        "publishingCredentials": null,
        "parameters": null,
        "allSettings": null,
        "manifestUrl": null,
        "storageResourceId": null,
        "tenantId": "54826b22-38d6-4fb2-bad9-b7b93a3e9c5a",
        "migrationToken": null,
        "isCmekEnabled": false,
        "cmekKeyVaultUrl": null,
        "openWithHint": null,
        "appPasswordHint": null,
        "publicNetworkAccess": null,
        "disableLocalAuth": false,
        "cmekEncryptionStatus": "Off",
        "provisioningState": "Succeeded"
      },
      "zones": []
    },
    {
      "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/botTest-rg/providers/Microsoft.BotService/botServices/testBot_westus",
      "name": "testBot_westus",
      "type": "Microsoft.BotService/botServices",
      "etag": "\"1c014c7d-0000-0200-0000-6388adfc0000\"",
      "location": "westus",
      "sku": {
        "name": "F0"
      },
      "kind": "bot",
      "tags": {},
      "properties": {
        "displayName": "testBot_westus",
        "description": null,
        "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png",
        "endpoint": "",
        "msaAppId": "94394b24-eaf9-40dc-b7ed-59817ce3983d",
        "msaAppTenantId": null,
        "msaAppType": null,
        "msaAppMSIResourceId": null,
        "developerAppInsightKey": null,
        "developerAppInsightsApplicationId": null,
        "luisAppIds": [],
        "endpointVersion": "3.0",
        "configuredChannels": [
          "webchat"
        ],
        "enabledChannels": [
          "webchat",
          "directline"
        ],
        "isDeveloperAppInsightsApiKeySet": false,
        "isStreamingSupported": false,
        "schemaTransformationVersion": "1.3",
        "publishingCredentials": null,
        "parameters": null,
        "allSettings": null,
        "manifestUrl": null,
        "storageResourceId": null,
        "tenantId": "54826b22-38d6-4fb2-bad9-b7b93a3e9c5a",
        "migrationToken": null,
        "isCmekEnabled": false,
        "cmekKeyVaultUrl": null,
        "openWithHint": null,
        "appPasswordHint": null,
        "publicNetworkAccess": null,
        "disableLocalAuth": false,
        "cmekEncryptionStatus": "Off",
        "provisioningState": "Succeeded"
      },
      "zones": []
    },
    {
      "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/botTest-rg/providers/Microsoft.BotService/botServices/testBot_global",
      "name": "testBot_global",
      "type": "Microsoft.BotService/botServices",
      "etag": "\"6800b1a5-0000-1800-0000-6388ae5d0000\"",
      "location": "global",
      "sku": {
        "name": "F0"
      },
      "kind": "bot",
      "tags": {},
      "properties": {
        "displayName": "testBot_global",
        "description": null,
        "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png",
        "endpoint": "",
        "msaAppId": "51f84f37-0b28-4e00-9ea6-576e2db57dd2",
        "msaAppTenantId": null,
        "msaAppType": null,
        "msaAppMSIResourceId": null,
        "developerAppInsightKey": null,
        "developerAppInsightsApplicationId": null,
        "luisAppIds": [],
        "endpointVersion": "3.0",
        "configuredChannels": [
          "webchat"
        ],
        "enabledChannels": [
          "webchat",
          "directline"
        ],
        "isDeveloperAppInsightsApiKeySet": false,
        "isStreamingSupported": false,
        "schemaTransformationVersion": "1.3",
        "publishingCredentials": null,
        "parameters": null,
        "allSettings": null,
        "manifestUrl": null,
        "storageResourceId": null,
        "tenantId": "54826b22-38d6-4fb2-bad9-b7b93a3e9c5a",
        "migrationToken": null,
        "isCmekEnabled": false,
        "cmekKeyVaultUrl": null,
        "openWithHint": null,
        "appPasswordHint": null,
        "publicNetworkAccess": null,
        "disableLocalAuth": false,
        "cmekEncryptionStatus": "Off",
        "provisioningState": "Succeeded"
      },
      "zones": []
    },
    {
      "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/botTest-rg/providers/Microsoft.BotService/botServices/testBot_westus",
      "name": "testBot_westus",
      "type": "Microsoft.BotService/botServices",
      "etag": "\"1c014c7d-0000-0200-0000-6388adfc0000\"",
      "location": "westus",
      "sku": {
        "name": "F0"
      },
      "kind": "bot",
      "tags": {},
      "properties": {
        "displayName": "testBot_westus",
        "description": null,
        "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png",
        "endpoint": "",
        "msaAppId": "94394b24-eaf9-40dc-b7ed-59817ce3983d",
        "msaAppTenantId": null,
        "msaAppType": null,
        "msaAppMSIResourceId": null,
        "developerAppInsightKey": null,
        "developerAppInsightsApplicationId": null,
        "luisAppIds": [],
        "endpointVersion": "3.0",
        "configuredChannels": [
          "webchat"
        ],
        "enabledChannels": [
          "webchat",
          "directline"
        ],
        "isDeveloperAppInsightsApiKeySet": false,
        "isStreamingSupported": false,
        "schemaTransformationVersion": "1.3",
        "publishingCredentials": null,
        "parameters": null,
        "allSettings": null,
        "manifestUrl": null,
        "storageResourceId": null,
        "tenantId": "54826b22-38d6-4fb2-bad9-b7b93a3e9c5a",
        "migrationToken": null,
        "isCmekEnabled": false,
        "cmekKeyVaultUrl": null,
        "openWithHint": null,
        "appPasswordHint": null,
        "publicNetworkAccess": null,
        "disableLocalAuth": false,
        "cmekEncryptionStatus": "Off",
        "provisioningState": "Succeeded"
      },
      "zones": []
    }
  ]
}

DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:

DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: AzureQoSEvent: Module: Az.BotService:0.1.0; CommandName: Get-AzBotService; PSVersion: 7.2.7; IsSuccess: True; Duration: 00:00:03.2677685
Etag                                   Kind Location Name           SkuName SkuTier Zone
----                                   ---- -------- ----           ------- ------- ----
"6800b1a5-0000-1800-0000-6388ae5d0000" bot  global   testBot_global F0              {}
"1c014c7d-0000-0200-0000-6388adfc0000" bot  westus   testBot_westus F0              {}
"6800b1a5-0000-1800-0000-6388ae5d0000" bot  global   testBot_global F0              {}
"1c014c7d-0000-0200-0000-6388adfc0000" bot  westus   testBot_westus F0              {}

Environment data

PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.7
PSEdition                      Core
GitCommitId                    7.2.7
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

PS> Get-Module Az*

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.11.0                Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzC…
Script     0.1.0                 Az.BotService                       {Export-AzBotServiceApp, Get-AzBotService, Ge…
Script     6.1.0                 Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpe…

Error output

No response

ghost commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @sgellock.

Issue Details
### Description If we have several bot services under current subscription whose locations are not the same. When we calling `Get-AzBotService` to get a list of bot services from current subscription or from a resource group, there will be duplicated outputs. How many times the output repeat depends on how many different locations there are. ### Issue script & Debug output ```PowerShell PS> $DebugPreference='Continue' PS> Get-AzBotService -ResourceGroupName botTest-rg DEBUG: 9:40:34 PM - GetAzureRMContextCommand end processing. DEBUG: [CmdletBeginProcessing]: Starting command DEBUG: CmdletBeginProcessing: DEBUG: CmdletProcessRecordStart: DEBUG: CmdletGetPipeline: DEBUG: CmdletBeforeAPICall: DEBUG: URLCreated: /subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/botTest-rg/providers/Microsoft.BotService/botServices?api-version=2022-06-15-preview DEBUG: RequestCreated: /subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/botTest-rg/providers/Microsoft.BotService/botServices?api-version=2022-06-15-preview DEBUG: HeaderParametersAdded: DEBUG: ============================ HTTP REQUEST ============================ HTTP Method: GET Absolute Uri: https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/botTest-rg/providers/Microsoft.BotService/botServices?api-version=2022-06-15-preview Headers: x-ms-unique-id : 7 x-ms-client-request-id : a06fc71e-84a7-4731-af73-df503f2b294e CommandName : Get-AzBotService FullCommandName : Get-AzBotService_List ParameterSetName : __AllParameterSets User-Agent : AzurePowershell/v0.0.0,PSVersion/v7.2.7,Az.BotService/0.1.0 Body: DEBUG: BeforeCall: DEBUG: ============================ HTTP RESPONSE ============================ Status Code: OK Headers: Cache-Control : no-cache Pragma : no-cache x-ms-original-request-ids : 801978b0-cd0b-4647-8e7e-5a64bf281ae1,e38daa96-ee49-4de9-b104-1a7e0656601e x-ms-ratelimit-remaining-subscription-reads: 11999 x-ms-request-id : 5fb82771-8b7e-492d-9bc4-28d0f8824b92 x-ms-correlation-request-id : 5fb82771-8b7e-492d-9bc4-28d0f8824b92 x-ms-routing-request-id : SOUTHEASTASIA:20221201T134038Z:5fb82771-8b7e-492d-9bc4-28d0f8824b92 Strict-Transport-Security : max-age=31536000; includeSubDomains X-Content-Type-Options : nosniff Date : Thu, 01 Dec 2022 13:40:38 GMT Body: { "value": [ { "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/botTest-rg/providers/Microsoft.BotService/botServices/testBot_global", "name": "testBot_global", "type": "Microsoft.BotService/botServices", "etag": "\"6800b1a5-0000-1800-0000-6388ae5d0000\"", "location": "global", "sku": { "name": "F0" }, "kind": "bot", "tags": {}, "properties": { "displayName": "testBot_global", "description": null, "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", "endpoint": "", "msaAppId": "51f84f37-0b28-4e00-9ea6-576e2db57dd2", "msaAppTenantId": null, "msaAppType": null, "msaAppMSIResourceId": null, "developerAppInsightKey": null, "developerAppInsightsApplicationId": null, "luisAppIds": [], "endpointVersion": "3.0", "configuredChannels": [ "webchat" ], "enabledChannels": [ "webchat", "directline" ], "isDeveloperAppInsightsApiKeySet": false, "isStreamingSupported": false, "schemaTransformationVersion": "1.3", "publishingCredentials": null, "parameters": null, "allSettings": null, "manifestUrl": null, "storageResourceId": null, "tenantId": "54826b22-38d6-4fb2-bad9-b7b93a3e9c5a", "migrationToken": null, "isCmekEnabled": false, "cmekKeyVaultUrl": null, "openWithHint": null, "appPasswordHint": null, "publicNetworkAccess": null, "disableLocalAuth": false, "cmekEncryptionStatus": "Off", "provisioningState": "Succeeded" }, "zones": [] }, { "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/botTest-rg/providers/Microsoft.BotService/botServices/testBot_westus", "name": "testBot_westus", "type": "Microsoft.BotService/botServices", "etag": "\"1c014c7d-0000-0200-0000-6388adfc0000\"", "location": "westus", "sku": { "name": "F0" }, "kind": "bot", "tags": {}, "properties": { "displayName": "testBot_westus", "description": null, "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", "endpoint": "", "msaAppId": "94394b24-eaf9-40dc-b7ed-59817ce3983d", "msaAppTenantId": null, "msaAppType": null, "msaAppMSIResourceId": null, "developerAppInsightKey": null, "developerAppInsightsApplicationId": null, "luisAppIds": [], "endpointVersion": "3.0", "configuredChannels": [ "webchat" ], "enabledChannels": [ "webchat", "directline" ], "isDeveloperAppInsightsApiKeySet": false, "isStreamingSupported": false, "schemaTransformationVersion": "1.3", "publishingCredentials": null, "parameters": null, "allSettings": null, "manifestUrl": null, "storageResourceId": null, "tenantId": "54826b22-38d6-4fb2-bad9-b7b93a3e9c5a", "migrationToken": null, "isCmekEnabled": false, "cmekKeyVaultUrl": null, "openWithHint": null, "appPasswordHint": null, "publicNetworkAccess": null, "disableLocalAuth": false, "cmekEncryptionStatus": "Off", "provisioningState": "Succeeded" }, "zones": [] }, { "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/botTest-rg/providers/Microsoft.BotService/botServices/testBot_global", "name": "testBot_global", "type": "Microsoft.BotService/botServices", "etag": "\"6800b1a5-0000-1800-0000-6388ae5d0000\"", "location": "global", "sku": { "name": "F0" }, "kind": "bot", "tags": {}, "properties": { "displayName": "testBot_global", "description": null, "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", "endpoint": "", "msaAppId": "51f84f37-0b28-4e00-9ea6-576e2db57dd2", "msaAppTenantId": null, "msaAppType": null, "msaAppMSIResourceId": null, "developerAppInsightKey": null, "developerAppInsightsApplicationId": null, "luisAppIds": [], "endpointVersion": "3.0", "configuredChannels": [ "webchat" ], "enabledChannels": [ "webchat", "directline" ], "isDeveloperAppInsightsApiKeySet": false, "isStreamingSupported": false, "schemaTransformationVersion": "1.3", "publishingCredentials": null, "parameters": null, "allSettings": null, "manifestUrl": null, "storageResourceId": null, "tenantId": "54826b22-38d6-4fb2-bad9-b7b93a3e9c5a", "migrationToken": null, "isCmekEnabled": false, "cmekKeyVaultUrl": null, "openWithHint": null, "appPasswordHint": null, "publicNetworkAccess": null, "disableLocalAuth": false, "cmekEncryptionStatus": "Off", "provisioningState": "Succeeded" }, "zones": [] }, { "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/botTest-rg/providers/Microsoft.BotService/botServices/testBot_westus", "name": "testBot_westus", "type": "Microsoft.BotService/botServices", "etag": "\"1c014c7d-0000-0200-0000-6388adfc0000\"", "location": "westus", "sku": { "name": "F0" }, "kind": "bot", "tags": {}, "properties": { "displayName": "testBot_westus", "description": null, "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", "endpoint": "", "msaAppId": "94394b24-eaf9-40dc-b7ed-59817ce3983d", "msaAppTenantId": null, "msaAppType": null, "msaAppMSIResourceId": null, "developerAppInsightKey": null, "developerAppInsightsApplicationId": null, "luisAppIds": [], "endpointVersion": "3.0", "configuredChannels": [ "webchat" ], "enabledChannels": [ "webchat", "directline" ], "isDeveloperAppInsightsApiKeySet": false, "isStreamingSupported": false, "schemaTransformationVersion": "1.3", "publishingCredentials": null, "parameters": null, "allSettings": null, "manifestUrl": null, "storageResourceId": null, "tenantId": "54826b22-38d6-4fb2-bad9-b7b93a3e9c5a", "migrationToken": null, "isCmekEnabled": false, "cmekKeyVaultUrl": null, "openWithHint": null, "appPasswordHint": null, "publicNetworkAccess": null, "disableLocalAuth": false, "cmekEncryptionStatus": "Off", "provisioningState": "Succeeded" }, "zones": [] } ] } DEBUG: ResponseCreated: DEBUG: BeforeResponseDispatch: DEBUG: Finally: DEBUG: CmdletAfterAPICall: DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process DEBUG: CmdletProcessRecordAsyncEnd: DEBUG: CmdletProcessRecordEnd: DEBUG: AzureQoSEvent: Module: Az.BotService:0.1.0; CommandName: Get-AzBotService; PSVersion: 7.2.7; IsSuccess: True; Duration: 00:00:03.2677685 Etag Kind Location Name SkuName SkuTier Zone ---- ---- -------- ---- ------- ------- ---- "6800b1a5-0000-1800-0000-6388ae5d0000" bot global testBot_global F0 {} "1c014c7d-0000-0200-0000-6388adfc0000" bot westus testBot_westus F0 {} "6800b1a5-0000-1800-0000-6388ae5d0000" bot global testBot_global F0 {} "1c014c7d-0000-0200-0000-6388adfc0000" bot westus testBot_westus F0 {} ``` ### Environment data ```PowerShell PS> $PSVersionTable Name Value ---- ----- PSVersion 7.2.7 PSEdition Core GitCommitId 7.2.7 OS Microsoft Windows 10.0.22621 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0 ``` ### Module versions ```PowerShell PS> Get-Module Az* ModuleType Version PreRelease Name ExportedCommands ---------- ------- ---------- ---- ---------------- Script 2.11.0 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzC… Script 0.1.0 Az.BotService {Export-AzBotServiceApp, Get-AzBotService, Ge… Script 6.1.0 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpe… ``` ### Error output _No response_
Author: NoriZC
Assignees: -
Labels: `Service Attention`, `bug`, `Bot Service`, `Tracking`
Milestone: -
boydc2014 commented 6 months ago

A few updates on this issue:

We are reaching out to owners of the script generation part to get more help

NoriZC commented 6 months ago

Hi @boydc2014, you can see from the debug log that there is only one request, and in the respond body there are duplicated items.

kunsinghms commented 1 week ago

We are able to reproduce the issue when triggering the API from Powershell :

When all the Bots are in same region i.e. Global, the API is functioning as expected - 1 occurrence of every bot:

image

When we have any bot present in any other region i.e. Global and Central India, all the bots under that RG are being duplicated in the result:

image

And when there are more than 2 regions, then the result is showing 3 occurrences of all the bots, 2 occurrences of 1 region and 1 occurrence of 1 region:

image

Dong's comment was correct on this Issue. The Powershell is triggering the API internally multiple times based on regions.