public static WindowsAzureRole configureKeyFeatures(
      WindowsAzureRole role, Map<String, Boolean> ftrMap) throws Exception {
    try {
      // Enable Key features
      // Session Affinity
      if (ftrMap.get("ssnAffChecked")) {
        WindowsAzureEndpoint httpEndPt = role.getEndpoint(httpEp);
        if (httpEndPt == null) {
          /*
           * server is not enabled.
           * hence create new endpoint
           * for session affinity.
           */
          if (role.isValidEndpoint(
              httpEp, WindowsAzureEndpointType.Input, HTTP_PRV_PORT, HTTP_PORT)) {
            httpEndPt =
                role.addEndpoint(httpEp, WindowsAzureEndpointType.Input, HTTP_PRV_PORT, HTTP_PORT);
          }
        }
        if (httpEndPt != null) {
          role.setSessionAffinityInputEndpoint(httpEndPt);
        }
      }

      // Caching
      if (ftrMap.get("cacheChecked")) {
        role.setCacheMemoryPercent(CACH_DFLTVAL);
        role.setCacheStorageAccountName(dashAuto);
      }

      // Remote Debugging
      if (ftrMap.get("debugChecked")) {
        if (role.isValidEndpoint(dbgEp, WindowsAzureEndpointType.Input, DEBUG_PORT, DEBUG_PORT)) {
          WindowsAzureEndpoint dbgEndPt =
              role.addEndpoint(dbgEp, WindowsAzureEndpointType.Input, DEBUG_PORT, DEBUG_PORT);
          if (dbgEndPt != null) {
            role.setDebuggingEndpoint(dbgEndPt);
            role.setStartSuspended(false);
          }
        }
      }

    } catch (Exception e) {
      throw new Exception(e.getMessage(), e);
    }
    return role;
  }