Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support long-running operations (New-MgTeam async operation is not handled within PowerShell SDK) #897

Closed
mhupfauer opened this issue Oct 10, 2021 · 7 comments
Assignees
Milestone

Comments

@mhupfauer
Copy link

The teamsAsyncOperation returned by POST /beta/teams is not handled within the PowerShell SDK.
The documentation however mentions the return of an object typed as Microsoft.Graph.PowerShell.Models.IMicrosoftGraphTeam

@ghost ghost added the ToTriage label Oct 10, 2021
@peombwa
Copy link
Member

peombwa commented Oct 18, 2021

According to the API docs, teamAysncOperation is returned in the location header when a team is created since the request is non-committal (returns 202 status code). The request itself returns no response object.

The SDK does not currently deserialize headers. Your options at the moment are:

  • Use New-MgTeam @params -Debug to log location header to the debug stream.
  • Use Invoke-MgGraphRequest with an -OutputType of HttpResponseMessage.
    Invoke-MgGraphRequest -Uri https://graph.microsoft.com/v1.0/teams -Body @params -Method POST 
    -OutputType HttpResponseMessage

I'll keep this issue open a feature request for us to:

@peombwa peombwa self-assigned this Oct 18, 2021
@peombwa peombwa added this to the Backlog milestone Oct 18, 2021
@peombwa peombwa changed the title New-MgTeam async operation is not handled within PowerShell SDK Support long-running operations (New-MgTeam async operation is not handled within PowerShell SDK) Oct 18, 2021
@peombwa
Copy link
Member

peombwa commented Apr 18, 2023

Update on the issue. The code generator now supports LRO.

To have LRO support, we will need to set x-ms-long-running-operation: true on OpenAPI operations that support LRO. For example:

  /teams:
    post:
      tags:
        - teams.team
      summary: Create team
      description: Create a new team.
      operationId: teams.team_CreateTeam
      x-ms-long-running-operation: true # This needs to be added
      requestBody:
        description: New entity
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/microsoft.graph.team'
        required: true
      responses:
        '2XX':
          description: Created entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/microsoft.graph.team'
        default:
          $ref: '#/components/responses/error'
      x-ms-docs-operation-type: operation

The work to add LRO support in the SDK will be scheduled post Microsoft Graph PowerShell v2.

Progress bars on LRO commands will be available in AutoREST.PowerShell v4 - Azure/autorest.powershell#1013.

@peombwa peombwa modified the milestones: Backlog, v2 Apr 18, 2023
@peombwa peombwa modified the milestones: v2, v3 May 1, 2023
@timayabi2020
Copy link
Contributor

Similar to #2394

@timayabi2020
Copy link
Contributor

Closing this issue because the latest release deserializes headers and outputs them to a hash table.
image

@CarolKigoonya
Copy link

#2600 to resolve this

@CarolKigoonya CarolKigoonya reopened this Feb 19, 2024
@timayabi2020
Copy link
Contributor

Issue resolved in 2.15.0 release.

Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants