Update 44 files
- /Daily_Backup_review/database_s3_check.ps1 - /Daily_Backup_review/Get-StorageContainerContent.ps1 - /Daily_Backup_review/Global_Checks.ps1 - /Daily_Backup_review/list_table_within_databases.ps1 - /Daily_Backup_review/Start-AzureSQLExport.ps1 - /Daily_Backup_review/Start-BackupCheckBpScus.ps1 - /Daily_Backup_review/Start-BackupCheckBpWeu.ps1 - /Daily_Backup_review/Start-BackupCheckRoserAttachments.ps1 - /Daily_Backup_review/Start-BackupCheckRoserCloud.ps1 - /Daily_Backup_review/Start-BackupCheckTotal.ps1 - /Daily_Backup_review/Start-DatabaseExport.ps1 - /Daily_Backup_review/Start-PointInTimeRestore.ps1 - /Daily_Backup_review/list_databases_within_instances.py - /Daily_Citrix_VDA_and_Server_Utilization_review/Cloudwatch_review/cloudwatch_alarm_ap-southeast-2.json - /Daily_Citrix_VDA_and_Server_Utilization_review/Cloudwatch_review/Cloudwatch_review.ps1 - /Ansible/audit-netscaler-exp.yaml - /Ansible/concurrent-user.yaml - /Ansible/do-something.yaml - /Ansible/hello-world.yaml - /Ansible/p6-log-cleanup.yaml - /Ansible/Roser_DB_backup_one_off.yaml - /Ansible/test-sql.yaml - /Ansible/test-sql-double-creds.yaml - /RoserUsefull/access_bulk_servers.ps1 - /RoserUsefull/access_bulk_servers_cezar.ps1 - /RoserUsefull/Bulk_copy_files.ps1 - /RoserUsefull/Besfort_data.ps1 - /RoserUsefull/check_permissions_bulk_servers.ps1 - /RoserUsefull/Check-p6interface-checksum.ps1 - /RoserUsefull/compare_files.ps1 - /RoserUsefull/connections_parser.ps1 - /RoserUsefull/drop_rds_registry_key.ps1 - /RoserUsefull/EmergencyAccessRemote.ps1 - /RoserUsefull/Keycloak_TestConnection.ps1 - /RoserUsefull/Kickoff_disconnected_users.ps1 - /RoserUsefull/launch_jira.ps1 - /RoserUsefull/launch_jira_gui.ps1 - /RoserUsefull/ownership_taker_anonymized.ps1 - /RoserUsefull/purge_files.ps1 - /RoserUsefull/remove_local_profiles_PowerShell.PS1 - /RoserUsefull/retrieve_attachements.ps1 - /RoserUsefull/Send_patch_multiple_servers.ps1 - /RoserUsefull/Test-RSAAPI-BP.ps1 - /RoserUsefull/Linux_identify_big_files.sh
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
|
||||
# Keycloak Server
|
||||
[ValidateNotNullOrEmpty()]
|
||||
$Keycloak_Server = 'https://keycloak-acc-bp-weu.roser-ict.com',
|
||||
|
||||
# ClientID From Keycloak
|
||||
[ValidateNotNullOrEmpty()]
|
||||
$ClientID = 'BP_Rotterdam',
|
||||
|
||||
# ClientSecret From Keycloak
|
||||
[ValidateNotNullOrEmpty()]
|
||||
$ClientSecret = 'a2bb4f34-d415-4cba-807f-c68a41b9cb3c',
|
||||
|
||||
# Keycloak Realm
|
||||
[ValidateNotNullOrEmpty()]
|
||||
$Realm='BP_Rotterdam'
|
||||
|
||||
)
|
||||
|
||||
|
||||
$VerbosePreference='continue'
|
||||
|
||||
# Example Powershell Code for connecting to the API and retrieving supported languages
|
||||
$APIswagger = 'https://api-acc-bp-weu.roser-ict.com/api/welding/swagger.yml'
|
||||
$APIlanguages = 'https://api-acc-bp-weu.roser-ict.com/api/configuration/languages'
|
||||
$APIwelding = 'https://api-acc-bp-weu.roser-ict.com/api/welding/report'
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
if(-not $ClientSecret) {
|
||||
Write-Error 'Please configure $ClientSecret' -ErrorAction STOP
|
||||
}
|
||||
|
||||
$RequestURL = $Keycloak_Server + "/auth/realms/$Realm/protocol/openid-connect/token"
|
||||
|
||||
$body = @{
|
||||
grant_type='client_credentials'
|
||||
client_id=$ClientID
|
||||
client_secret=$ClientSecret
|
||||
}
|
||||
|
||||
# Token Request
|
||||
$result = Invoke-WebRequest -Method POST -Uri $RequestURL -ContentType "application/x-www-form-urlencoded" -Body $body
|
||||
$Content = $result.Content | ConvertFrom-Json
|
||||
|
||||
$Params = @{
|
||||
"URI" = $APIswagger
|
||||
"Method" = 'GET'
|
||||
"Headers" = @{
|
||||
"Content-Type" = 'application/json'
|
||||
"Authorization" = "Bearer $($Content.access_token)"
|
||||
}
|
||||
}
|
||||
$Swagger = Invoke-RestMethod @Params
|
||||
|
||||
Write-Output $Swagger
|
||||
|
||||
|
||||
$Params = @{
|
||||
"URI" = $APIlanguages
|
||||
"Method" = 'GET'
|
||||
"Headers" = @{
|
||||
"Content-Type" = 'application/json'
|
||||
"Authorization" = "Bearer $($Content.access_token)"
|
||||
}
|
||||
}
|
||||
Invoke-RestMethod @Params
|
||||
|
||||
$Params = @{
|
||||
"URI" = $APIwelding
|
||||
"Method" = 'POST'
|
||||
"Headers" = @{
|
||||
"Content-Type" = 'application/json'
|
||||
"Authorization" = "Bearer $($Content.access_token)"
|
||||
}
|
||||
}
|
||||
Invoke-RestMethod @Params -Verbose
|
||||
|
||||
$Params.Method = 'GET'
|
||||
$WelditReports = Invoke-RestMethod @Params -Verbose
|
||||
|
||||
write-output "Received $($WelditReports.Count) Reports"
|
||||
Reference in New Issue
Block a user