Skip to content

Remove support for PowerShell 5.x and below from CosmosDB module v7.0 onwards #502

@PlagueHO

Description

@PlagueHO

Due to the complexity in maintaining exception handling within the Invoke-CosmosDbRequest function across both Windows PowerShell 5.x and PowerShell 7+ propose to drop support for Windows PowerShell 5.x from CosmosDB module 7.0.0 onwards.

CosmosDB module version 6.0 and older will still be available, but will no longer be updated. If you require Windows PowerShell support then you will need to pin this version.

This is because:

  • Invoke-WebRequest functions return different exception objects across these versions, with the 5.x throwing System.Net.WebException while 7.x throwing Microsoft.PowerShell.Commands.HttpResponseException.
  • Unit testing of System.Net.WebException is difficult because unable to create a mock exception as input.
  • The Invoke-CosmosDbRequest needs to return a custom exception CosmosDB.ResponseException that contains some information from the Microsoft.PowerShell.Commands.HttpResponseException, but not the authorization request headers. To convert the Microsoft.PowerShell.Commands.HttpResponseException to CosmosDB.ResponseException will require logic that isn't easily producable for System.Net.WebException.
  • The time taken to execute unit tests on Windows PowerShell 5.x is significantly (3x) that of PowerShell 7.x. Removing these tests will speed up CI significantly.
  • Moving to PS 7.x recommended if possible.

Windows will still be supported through PS 7.x and above. Ubuntu and MacOS will of course be supported only on PS 7.x.

Aim to complete this by end of July 2025. There will be one final release (v6.0) that supports Windows PowerShell 5.x and this is to remove an issue where PS7.x can make authorization headers available to calling code when an exception occurs.

Metadata

Metadata

Assignees

Labels

discussionThe issue is a discussion.enhancementThe issue is an enhancement request.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions