cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1108
Views
0
Helpful
0
Comments
Orf Gelbrich
Cisco Employee
Cisco Employee
Task NameExample on using the credential policy in concjunction with power shell
Description

Prerequisites

Tested on 5.5

CategoryWorkflow
ComponentsvSphere 5.x
User Inputs


Instructions for Regular Workflow Use:

  1. Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
  2. Unzip the file on your computer. Should end up with a .WFD file.
  3. Log in to UCS Director as a user that has "system-admin" privileges.
  4. Navigate to "Policies-->Orchestration" and click on "Import".
  5. Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
  6. Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
  7. Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
  8. Click "Submit".
  9. A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment.

The Workflow:



Screen Shot 2016-08-17 at 12.11.07 AM.png


The workflow custom task input:

Screen Shot 2016-08-17 at 12.12.28 AM.png

Mapped Input to the powershell task:

Screen Shot 2016-08-17 at 12.10.20 AM.png

The credential policy used:

Screen Shot 2016-08-17 at 12.15.19 AM.png

The custom task run:

Screen Shot 2016-08-17 at 12.19.42 AM.png

Screen Shot 2016-08-17 at 12.22.43 AM.png

The Custom task to get the credential policy information:

importPackage(com.cloupia.lib.connector.account.credential);

var config = PersistenceUtil.getCredentialPolicyByName(input.CredPolName);

if(config != null){

  logger.addInfo("Credentials retrieved successfully for Credential Account Policy: " + input.credentialPolicyName);

  output.accountUsername = config.getUserName();

  output.accountPassword = config.getPassword();

}

else{

  logger.addError("Failed to get information for Credential Account Policy: " + input.credentialPolicyName);

  ctxt.setFailed("Failed to get information for Credential Account Policy: " + input.credentialPolicyName);

}

Thank you Jeff Trumbull for this addition:

Code for dealing with AD accounts in the custom task:

importPackage(com.cloupia.lib.connector.account.credential);

var config = PersistenceUtil.getCredentialPolicyByName(input.CredPolName);

if(config != null){

                logger.addInfo("Credentials retrieved successfully for Credential Account Policy: " + input.credentialPolicyName);

                var splitAccount = config.getUserName().split("\\")

                if(splitAccount.length == 2){

                                logger.addInfo("User: " + splitAccount[1])

                                logger.addInfo("Domain: " + splitAccount[0])

                                output.accountDomain = splitAccount[0];

                                output.accountUsername = splitAccount[1];

                                output.accountPassword = config.getPassword();

                }

                else{

                                logger.addError("Failed to split domain and username. Verify domain\\username format: " + config.getUserName());

                                ctxt.setFailed("Failed to split domain and username. Verify domain\\username format: " + config.getUserName());

                }

}

else{

                logger.addError("Failed to get information for Credential Account Policy: " + input.credentialPolicyName);

                ctxt.setFailed("Failed to get information for Credential Account Policy: " + input.credentialPolicyName);

}

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links