Skip to content

Commit

Permalink
WIP on add_new_user_in_microsoft_teams
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdatasourav committed Nov 22, 2023
1 parent b311bd3 commit a6b9a47
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 0 deletions.
8 changes: 8 additions & 0 deletions add_new_user_in_microsoft_teams/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Analyze Domains Through Multiple Sources

Investigate suspicious domains and identify false positives by leveraging threat intelligence tools, including URLhaus, VirusTotal, and URLScan, to gather more context and respond faster.

## Usage

- Add your APIVoid, IP2Location, Urlscan and Virustotal API key to `flowpipe.pvars`
- Run the pipeline and specify `domain`, e.g., `flowpipe pipeline run domains_review_through_multiple_sources --pipeline-arg 'domain=example.com'`
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
pipeline "add_new_user_in_microsoft_teams" {
title = "Add a new user in Microsoft Office 365"
description = "Add a new user in Microsoft Office 365."

param "teams_access_token" {
type = string
description = "The MS Team access token to use for the API request."
default = var.teams_access_token
}

param "display_name" {
type = string
description = "The name to display in the address book for the user."
}

param "account_enabled" {
type = bool
description = "If the account is enabled then true; otherwise, false."
}

param "mail_nickname" {
type = string
description = "The mail alias for the user."
}

param "user_principal_name" {
type = string
description = "The user principal name ([email protected])."
}

param "password" {
type = string
description = "The password for the user."
}

param "license_sku_ids" {
type = list(string)
description = "The unique identifier for the available licenses."
}

# Create user
step "pipeline" "create_user" {
pipeline = teams.pipeline.create_user
args = {
access_token = param.teams_access_token
password = param.password
user_principal_name = param.user_principal_name
mail_nickname = param.mail_nickname
account_enabled = param.account_enabled
display_name = param.display_name

}
}

# Asign license to the user
step "pipeline" "assign_licenses_to_user" {
depends_on = [step.pipeline.create_user]
pipeline = teams.pipeline.assign_licenses_to_user
args = {
access_token = param.teams_access_token
sku_ids = param.license_sku_ids
user_id = param.user_principal_name
}
}

# Create JIRA issue
step "pipeline" "create_issue" {
depends_on = [step.pipeline.assign_licenses_to_user]
pipeline = jira.pipeline.create_issue
args = {
api_base_url = param.api_base_url
token = param.token
user_email = param.user_email
project_key = param.project_key
summary = "Added a new user: ${step.pipeline.create_user.output.create_user.userPrincipalName}"
description = step.pipeline.create_user.output.create_user
issue_type = param.issue_type
}
}


}
4 changes: 4 additions & 0 deletions add_new_user_in_microsoft_teams/flowpipe.pvars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apivoid_api_key=<APIVoid_API_Key>
ip2location_api_key=<IP2Location_API_Key>
urlscan_api_key=<Urlscan_API_Key>
virustotal_api_key=<Virustotal_API_Key>
22 changes: 22 additions & 0 deletions add_new_user_in_microsoft_teams/mod.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
mod "add_new_user_in_microsoft_teams" {
title = "Add a new user in Microsoft Office 365"
description = "Add a new user in Microsoft Office 365."

require {
mod "github.com/turbot/flowpipe-mod-teams" {
version = "v0.0.1-rc.6"
args = {
access_token = var.teams_access_token
}
}
mod "github.com/turbot/flowpipe-mod-jira" {
version = "v0.0.1-rc.2"
args = {
token = var.jira_token
user_email = var.jira_user_email
api_base_url = var.jira_api_base_url
project_key = var.jira_project_key
}
}
}
}
29 changes: 29 additions & 0 deletions add_new_user_in_microsoft_teams/variables.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
variable "jira_token" {
type = string
description = "Jira API access token."
# TODO: Add once supported
# sensitive = true
}

variable "jira_user_email" {
type = string
description = "Email-id of the Jira user."
}

variable "jira_api_base_url" {
type = string
description = "Jira API base URL."
}

variable "jira_project_key" {
type = string
description = "The key identifying the Jira project."
}

variable "teams_access_token" {
description = "The Microsoft personal security access_token to authenticate to the Microsoft graph APIs."
type = string
# TODO: Add once supported
#sensitive = true
default = "eyJ0eXAiOiJKV1QiLCJub25jZSI6IlgwUnNUV2ZPcVNLMXFSOTBLOWJ2a2JrQl95aG9zMmdkMjZsdHNfT25DdkEiLCJhbGciOiJSUzI1NiIsIng1dCI6IlQxU3QtZExUdnlXUmd4Ql82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