Closed bmw5000 closed 1 year ago
Hi @bmw5000, thanks for reporting. My preferred approach would be to have 2 string array parameters, 1 for attributes and 1 for custom fields. Having a switch allows us to only search on one or the other at 1 time. Any concerns with that approach?
Out of curiosity, why do you need a custom field named 'certificate'?
@gdbarron ,
I don't have any preference on how it gets implemented, as long as it results in being able to retrieve the attribute using VenafiPS.
Question: Why do the custom field query in the function at all. The customfields are available in the $VenafiSession variable. if you want to query custom fields, you can run that section of code in the calling application/script and pass the guid into Get-TppAttribute. This would give you the exact return for the attribute/guid provided.
As for the custom field name 'certificate', it is used in an adaptable app/ca combination to pass a certificate vault between the stages. In hindsight we would not name it the same, but currently it is used in code.
Thanks, Brandon
This is implemented for ease of use and so folks don't need to do the lookup and other coding involved, just make the call. Any change we make will be breaking so this might need to wait until the next major release or we simply document a duplicate name as a limitation. Will give it some thought.
Environment
Steps to reproduce
Create a custom field with a name of "Certificate". Create a device and Basic application. Associate a certificate to the application.
Run Get-TppAttribute -Path "\VED\Policy\Testing\Device\App" -Attribute "Certificate" -VenafiSession $mysession
Expected behavior
Retrieves Certificate attribute from object
Actual behavior
This code block Looks for custom fields with Label matching $thisAttribute.
It then replaces the AttributeName in $params.Body with the guid of the custom field
Desired behavior.
Add a switch that disables the overwrite of the supplied attribute with the custom field guid. or Add a switch to search custom field labels for the supplied attribute
Example 1
<....>
Example 2
<....>
Screenshots
Custom Field![image](https://user-images.githubusercontent.com/91341634/228703855-150989e2-a09b-42b0-8baf-89048303d920.png)
Device![image](https://user-images.githubusercontent.com/91341634/228698692-ff97e31f-91d1-4a0d-acbe-02346e8230c8.png)
App![image](https://user-images.githubusercontent.com/91341634/228698787-c772b225-1064-4530-9571-d89bb8ec0aa1.png)
Attribute exists on object![image](https://user-images.githubusercontent.com/91341634/228697968-28a1b83d-b528-4ec1-893e-c70aee234856.png)
Error![image](https://user-images.githubusercontent.com/91341634/228698048-9839a2b9-5551-4b73-90e1-2a4c59e4a34c.png)