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

Azure Government #86

Open
nconder opened this issue Aug 6, 2020 · 8 comments
Open

Azure Government #86

nconder opened this issue Aug 6, 2020 · 8 comments

Comments

@nconder
Copy link

nconder commented Aug 6, 2020

Is Azure Government supported? I am 100% confident that the subscription and workspace exists.

`Get-AzSentinelAlertRule -WorkspaceName "XXXXX" -Verbose
VERBOSE: Getting Worspace from Subscription XXXXXX-XXXXXXX-XXXXXX
VERBOSE: GET https://management.azure.com/subscriptions/XXXXXX-XXXXXXX-XXXXXX/providers/Microsoft.OperationalInsights/workspaces?api-version=2015-11-01-preview with 0-byte payload
VERBOSE: received 129-byte response of content type application/json
Invoke-WebRequest: C:\Users\XXXXXX\Documents\PowerShell\Modules\AzSentinel\0.6.5\AzSentinel.psm1:503
Line |
503 | … orkspaces = Invoke-webrequest -Uri $uri -Method get -Headers $script: …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| {"error":{"code":"SubscriptionNotFound","message":"The subscription 'XXXXXX-XXXXXXX-XXXXXX' could not be found."}}

ConvertFrom-Json: C:\Users\XXXXXX\Documents\PowerShell\Modules\AzSentinel\0.6.5\AzSentinel.psm1:504
Line |
504 | … $workspaceObject = ($workspaces.Content | ConvertFrom-Json).value …
| ~~~~~~~~~~~~~~~~
| Cannot bind argument to parameter 'InputObject' because it is null.

Write-Error: C:\Users\XXXXXX\Documents\PowerShell\Modules\AzSentinel\0.6.5\AzSentinel.psm1:2446
Line |
2446 | Get-LogAnalyticWorkspace @arguments
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unable to find workspace XXXXXXXX under Subscription Id: XXXXXX-XXXXXXX-XXXXXX`

@latortuga71
Copy link

@nconder i was able to get it to work for a little bit by using sed, to swap out all the api endpoints to the gov equivalent. but then my token would not refresh not sure why. On another note is it possible to limit the requests (via a filter ?)brought back when using Get-AzSentinelIncident?

@john-crouch
Copy link
Contributor

john-crouch commented Oct 22, 2020

I forked the project and added an ‘Environment’ parameter, supporting logic, and associated comment-based help: https://github.com/john-crouch/AZSentinel/tree/AzEnvironment

For any of the module's cmdlets, just include -Environment AzureUsGovernment

I'm happy to submit a PR if this is an acceptable solution. @NVolcz @maartengoet @bgelens

@NVolcz
Copy link
Contributor

NVolcz commented Nov 9, 2020

Not sure why I was mentioned in this issue :-).

@nconder
Copy link
Author

nconder commented Nov 30, 2020

I forked the project and added an ‘Environment’ parameter, supporting logic, and associated comment-based help: https://github.com/john-crouch/AZSentinel/tree/AzEnvironment

For any of the module's cmdlets, just include -Environment AzureUsGovernment

I'm happy to submit a PR if this is an acceptable solution. @NVolcz @maartengoet @bgelens

I uninstalled the release and tired you fork and I'm still getting 404's. Looks like the domain is still pointing to Azure public API "https://management.azure.com"

Get-AzSentinelAlertRule -SubscriptionId xxxxxxx-xxxx-xxxxx-xxxxx-xxxxxxxxx -WorkspaceName myworkspace -Verbose
VERBOSE: Getting Worspace from Subscription xxxxxxx-xxxx-xxxxx-xxxxx-xxxxxxxxx
VERBOSE: GET **https://management.azure.com**/subscriptions/xxxxxxx-xxxx-xxxxx-xxxxx-xxxxxxxxx/providers/Microsoft.OperationalInsights/workspaces?api-version=2015-11-01-preview with 0-byte payload
VERBOSE: received 129-byte response of content type application/json
Get-AzSentinelAlertRule: Response status code does not indicate success: 404 (Not Found).

Showing that I'm logged into the Gov environment.
Get-AzVM | select location
Location

usgovvirginia
usgovvirginia
usgovvirginia
usgovvirginia

@nconder
Copy link
Author

nconder commented Dec 1, 2020

@john-crouch, we identified and resolved the problems causing us to continue to point to Azure Public instead of the GOV domains. While not extensively tested we've validated Get-AzSentinelAlertRule and Get-AzSentinelHuntingRule work as expected but that Export-AzSentinel does not appear to be 'Environment' aware as it throws a "Export-AzSentinel: A parameter cannot be found that matches parameter name 'Environment'." message when the parameter is added. Thanks for your help and quick turnaround!

@john-crouch
Copy link
Contributor

@nconder thanks for the feedback! I've fixed the issue you identified and successfully tested Export-AzSentinel against an Azure gov subscription.

@nconder
Copy link
Author

nconder commented Dec 15, 2020

@nconder thanks for the feedback! I've fixed the issue you identified and successfully tested Export-AzSentinel against an Azure gov subscription.

Hi @john-crouch have you created a pull request yet if not did you need any help to validate?

@dave-simons
Copy link

Hi! I need to use AZSentinel with an Azure GOV environment too and am interested in this functionality being rolled up into the release version also.

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

No branches or pull requests

5 participants