Added optional OpenAI-Organization header to AzOAI#99
Merged
dfinke merged 6 commits intodfinke:mainfrom Jul 11, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds support for an optional OpenAI-Organization header in the Azure OpenAI cmdlets.
- Introduces an optional
organizationIdparameter inSet-AzOAISecrets - Stores the
organizationIdin the global secrets and updatesInvoke-OAIBetato set/remove theOpenAI-Organizationheader - Enhances help comments with version formatting and a new
.NOTESsection
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Public/Set-AzOAISecrets.ps1 | Added optional organizationId parameter, updated help block for apiVersion and deploymentName, and assigned the new field to $script:AzOAISecrets |
| Private/Invoke-OAIBeta.ps1 | Added conditional logic to include or remove the OpenAI-Organization header based on organizationId |
Comments suppressed due to low confidence (2)
Public/Set-AzOAISecrets.ps1:24
- Consider adding an example that demonstrates using the new
-organizationIdparameter in the.EXAMPLEsection to help users understand how to set this optional header.
Set-AzOAISecrets -apiURI "https://api.example.com" -apiKEY "myApiKey" -apiVersion "2024-10-21" -deploymentName "MyDeployment"
Private/Invoke-OAIBeta.ps1:61
- There are no tests covering the new
OpenAI-Organizationheader logic. Consider adding unit tests for whenorganizationIdis provided and when it is omitted to ensure correct header behavior.
if($AzOAISecrets.organizationId) {
Private/Invoke-OAIBeta.ps1
Outdated
|
|
||
| 'AzureOpenAI' { | ||
| $headers['api-key'] = "$($AzOAISecrets.apiKEY)" | ||
| if($AzOAISecrets.organizationId) { |
There was a problem hiding this comment.
The condition if ($AzOAISecrets.organizationId) will treat an empty string as true. Consider using if (-not [string]::IsNullOrEmpty($AzOAISecrets.organizationId)) to avoid sending an empty header value.
Suggested change
| if($AzOAISecrets.organizationId) { | |
| if (-not [string]::IsNullOrEmpty($AzOAISecrets.organizationId)) { |
…-OAIBeta function
Owner
|
@jmkloz Thank you for the PR! Are you on social media I can give a shout out to? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some organizations that use the Azure OpenAI implementation require the OpenAI-Organization header to be set. This change allows for this optional field to be set.