AZSentinel icon indicating copy to clipboard operation
AZSentinel copied to clipboard

Added fixed for case sensitive split and missing workspace name from …

Open LeonB87 opened this issue 3 years ago • 0 comments

Summary of the Pull Request

There was a small issue in enabling Sentinel on a workspace. Another user also opened an issue for this #192

  • The body of the request contained the text ($workspace) and not the actual workspace resource ID
  • The retrieval of the workspace failed as the splitting of the baseURL failed. Using $var.split("") is case sensitive. Switched to $var -split ("") as this is case insensitive and should prevent any issues.
  • fixed 2 small typo's in output ...

PR Checklist

By submitting this pull request, I confirm the following:

please fill any appropriate checkboxes, e.g: [X]

  • [X] Closes #192
  • [X] Requires documentation to be updated (N/A)
  • [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx
  • [X] I have made only one major change in my proposed changes.
  • [X] I have commented my proposed changes within the code.
  • [X] I have tested my proposed changes, and have included unit tests where possible.
  • [X] It is compatible with the MIT License
  • [X] I have squashed any insignificant commits. (git rebase)

Detailed Description of the Pull Request / Additional comments

There was a small issue in enabling Sentinel on a workspace. Another user also opened an issue for this #192

  • The body of the request contained the text ($workspace) and not the actual workspace resource ID. This is because $workspace was between single quotes
  • The retrieval of the workspace failed as the splitting of the baseURL failed. Using $baseUri.split("") is case sensitive. Switched to $baseUri -split ("") as this is case insensitive and should prevent any issues.
  • Fixed 2 small typo's in output (Sentinetal vs Sentinel)

Validation Steps Performed

$workspace = New-AzOperationalInsightsWorkspace -location 'southeastasia' -Name 'azla-sentinel' -
Sku 'PerGB2018' -ResourceGroupName 'azrg-sentinel' -Tag @{environment = 'Development'}

Set-AzSentinel -WorkspaceName $workspace.Name -confirm:$false

How does this PR accomplish the above

Prevents the 400 error code issue

LeonB87 avatar Jan 07 '22 13:01 LeonB87