Open MartinRiley opened 6 years ago
I'm having the same issue, any fix for this yet?
Hey MartinRiley,
Pardon the delay in response, I have been out of state for a while now and am catching up.
Would you be able to run Get-ITGlueBaseURI
? If you are using IT Glue's API without any proxies or other more advanced use cases, you should just get http://api.itglue.com
as the output. If you do not, please run Add-ITGlueBaseURI
without parameters to make it default to the http://api.itglue.com
address.
If you are still getting an error, I would suggest re-adding your API key. Afterwards, it is advantageous to run Export-ITGlueModuleSettings
so that the working URI and API key are auto-imported when you load the module.
As for the Get-ITGlueAPIKey
, it will not return the unencrypted API key even with the -Force
parameter as a security measure, as your API key is able to access all IT Glue data across all organizations, which can be somewhat dangerous if given in plaintext. As such, it returns an object that contains the encrypted version. The -Force
option is depreciated and I appreciate you bringing it to my attention, as it was meant to be removed.
You are able to unencrypted your API key if you so desire by running (New-Object System.Management.Automation.PSCredential 'N/A', $ITGlue_API_Key).GetNetworkCredential().Password)
, which is a PowerShell cmdlet built for managing SecureStrings. It uses reversible encryption tied to your user principle (user account on your specific Windows device).
Please let me know if setting the Base URI to the default works. If not, let's run Get-ITGlueUsers
or some other command to test that the module is set up properly before continuing on with the ActiveDirectory script troubleshooting.
well caleb just sent me a msg i will check in 2 days if it works i will let you know
Van: taylormaguire notifications@github.com Verzonden: zondag 21 januari 2018 0:41 Aan: itglue/automation CC: MartinRiley; Author Onderwerp: Re: [itglue/automation] Does not upload to ITGlue because the following error. (#4)
I'm having the same issue, any fix for this yet?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/itglue/automation/issues/4#issuecomment-359211038, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AhcWTZ5VeSUTYnYCGxbIgbLvr-YqaSRGks5tMnmcgaJpZM4RRulT.
Np thx for replaying i will check tuesday when im back at work and then i will let you know 😊
Van: Caleb Albers notifications@github.com Verzonden: zondag 21 januari 2018 3:02 Aan: itglue/automation CC: MartinRiley; Author Onderwerp: Re: [itglue/automation] Does not upload to ITGlue because the following error. (#4)
Hey MartinRiley,
Pardon the delay in response, I have been out of state for a while now and am catching up.
Would you be able to run Get-ITGlueBaseURI? If you are using IT Glue's API without any proxies or other more advanced use cases, you should just get http://api.itglue.com as the output. If you do not, please run Add-ITGlueBaseURI without parameters to make it default to the http://api.itglue.com address.
If you are still getting an error, I would suggest re-adding your API key. Afterwards, it is advantageous to run Export-ITGlueModuleSettings so that the working URI and API key are auto-imported when you load the module.
As for the Get-ITGlueAPIKey, it will not return the unencrypted API key even with the -Force parameter as a security measure, as your API key is able to access all IT Glue data across all organizations, which can be somewhat dangerous if given in plaintext. As such, it returns an object that contains the encrypted version. The -Force option is depreciated and I appreciate you bringing it to my attention, as it was meant to be removed.
You are able to unencrypted your API key if you so desire by running (New-Object System.Management.Automation.PSCredential 'N/A', $ITGlue_API_Key).GetNetworkCredential().Password), which is a PowerShell cmdlet built for managing SecureStrings. It uses reversible encryption tied to your user principle (user account on your specific Windows device).
Please let me know if setting the Base URI to the default works. If not, let's run Get-ITGlueUsers or some other command to test that the module is set up properly before continuing on with the ActiveDirectory script troubleshooting.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/itglue/automation/issues/4#issuecomment-359217846, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AhcWTejGejMcLPpvAfytLXUclN7Q91gFks5tMprNgaJpZM4RRulT.
@CalebAlbers when i ran it the first time i did use the default baseurl. (it was the http://api.itglue.com) And it did not work then. I think when i posted this it was with the base default api url.
I later on tried to do it with the company url and kept having the same problem.
I havent run the Get-ITGlueUsers yet. You have any kind of reference of how i can see that i do it in the correct way and get the correct output.
Or is there a way (maybe email) we can have some contact where i can sent some screenies :)
First time working with Powershell Scripts so i might completly forget something or do something totally wrong. I have screenshots of the time i posted this.
Greetings
PS C:\Program Files\WindowsPowerShell\Modules\ITGlueAPI> Get-ITGlueUsers
data links meta
{@{id=68079; type=users; attributes=... @{current-page=1; next-page=; prev-p...
PS C:\Program Files\WindowsPowerShell\Modules\ITGlueAPI>
as you can see this is the outcome for the get users command.
Getting Global Catalog Servers (Domain Controllers)... DC02,DC01,DC03,DC04 Active Directory flex asset configuration file found! No flexible asset id was found... creating a new flexible asset. Invoke-RestMethod : {"errors":[{"status":422,"title":"Unprocessable Entity","detail":"Request contains invalid trait keys","source":{"pointer":"data/attributes/traits"}}]} At C:\Program Files\WindowsPowerShell\Modules\ITGlueAPI\Resources\FlexibleAssets.ps1:12 char:20
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
PS C:\Users\jhill\Downloads\Active Directory> $output.data.attributes.'name-key' forest-name domain-full-name domain-short-name ad-level schema-master domain-naming-master relative-id-rid-master pdc-emulator-master infrastructure-master global-catalog-servers-domain-controllers
api_config-ActiveDirectory.psd1:
key_name_ADForestName = 'forest-name' key_name_DomainName = 'domain-full-name' key_name_DomainShortName = 'domain-short-name' key_name_ADFunctionalLevel = 'ad-level' key_name_SchemaMaster = 'schema-master' key_name_DomainNamingMaster = 'domain-naming-master' key_name_RIDMaster = 'relative-id-master' key_name_PDCEmulator = 'pdc-emulator-master' key_name_InfrastructureMaster = 'infrastructure-master' key_name_GlobalCatalogServers = 'global-catalog-servers-domain-controllers'
Any ideas? I've already completely deleted the Flexible Asset and recreated it to no avail.
relative-id-rid-master?
Wow...I'm embarrassed to admit how long I stared at this. Thank you!!!!!!
Is there a limitation on 2016 for the AD level? Invoke-RestMethod : {"errors":[{"source":{"pointer":"/data/attributes/flexible-asset-traits.ad level"},"detail":["can't be blank"],"title":"Unprocessable Entity","status":422}]} At C:\Program Files\WindowsPowerShell\Modules\ITGlueAPI\Resources\FlexibleAssets.ps1:12 char:20
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Did something change? Trying to run the active directory integration on a server that has completed successfully in the past. Getting errors now.
Active Directory flex asset configuration file found! Exception calling "Add" with "2" argument(s): "An item with the same key has already been added." At C:\Program Files\WindowsPowerShell\Modules\ITGlueAPI\Resources\Configurations.ps1:90 char:5
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentException
Cannot index into a null array. At C:\ITGlue\Active Directory\ActiveDirectory.ps1:175 char:5
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array. At C:\ITGlue\Active Directory\ActiveDirectory.ps1:176 char:5
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array. At C:\ITGlue\Active Directory\ActiveDirectory.ps1:177 char:5
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array. At C:\ITGlue\Active Directory\ActiveDirectory.ps1:178 char:5
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array. At C:\ITGlue\Active Directory\ActiveDirectory.ps1:179 char:5
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array. At C:\ITGlue\Active Directory\ActiveDirectory.ps1:185 char:9
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
No flexible asset id was found... creating a new flexible asset. Invoke-RestMethod : {"errors":[{"status":401,"title":"Unauthorized","detail":"Unauthorized resource access","source":{"pointer":"id"}}]} At C:\Program Files\WindowsPowerShell\Modules\ITGlueAPI\Resources\FlexibleAssets.ps1:12 char:20
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Oddly enough I'm getting the same as the original poster for a new client. Works fine at another client and creates and or updates the existing AD flexible asset. When I try at this client i get `Active Directory flex asset configuration file found! No flexible asset id was found... creating a new flexible asset. New-ITGlueFlexibleAssets : {"errors":[{"status":401,"title":"Unauthorized","detail":"Unauthorized resource access","source":{"pointer":"id"}}]} At C:\jobs\ActiveDirectory.ps1:338 char:41
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-ITGlueFlexibleAssets`
get-itglueusers, (get-itglueorganizations).data both return valid data. Same api key is used at each location.
Invoke-RestMethod : {"errors":[{"status":401,"title":"Unauthorized","detail":"Unauthorized resource access","source":{"pointer":"id"}}]} At C:\Program Files\WindowsPowerShell\Modules\ITGlueAPI\Resources\FlexibleAssets.ps1:12 char:20
for what i can see it looks like i did not put in the correct Uri?? But we dont use a gateway or anything so in my eyes it has to be the default uri?
other then that it seems because of the "Unauthorized resource access" that i dont have access to my own ITGlue.
an other problem that keep occuring and this might be relevant is that as soon as i type in Get-ITGlueAPIKey it doesent show me my apikey even with the Force command.
PS C:\Program Files\WindowsPowerShell\Modules\ITGlueAPI> Get-ITGlueAPIKey System.Security.SecureString Use Get-ITGlueAPIKey -Force to retrieve the unencrypted copy. PS C:\Program Files\WindowsPowerShell\Modules\ITGlueAPI> Get-ITGlueAPIKey -Force System.Security.SecureString Use Get-ITGlueAPIKey -Force to retrieve the unencrypted copy. PS C:\Program Files\WindowsPowerShell\Modules\ITGlueAPI> .\ActiveDirectory.ps1 -api api_config-ActiveDirectory.psd1
So if anyone can help me with what im doing wrong let me know thx :)