def create_indicator(self, indicator_data, indicator_id):
        """To create indicator into Microsoft Sentinel."""
        __method_name = inspect.currentframe().f_code.co_name
        try:
            retry_count_429 = 0
            retry_count_401 = 0
            retry_count_400 = 0
            while retry_count_429 <= 3 and retry_count_401 <= 1 and retry_count_400 <= 1:
                create_indicator_url = CREATE_SENTINEL_INDICATORS_URL.format(
                    subscriptionId=AZURE_SUBSCRIPTION_ID,
                    resourceGroupName=AZURE_RESOURCE_GROUP,
                    workspaceName=AZURE_WORKSPACE_NAME,
                )
                headers = {
                    "Content-Type": "application/json",
                    "Authorization": "Bearer {}".format(self.bearer_token),
                }
                response = make_rest_call(
                    url=create_indicator_url,
                    method="POST",
                    azure_function_name=RETRY_FAILED_INDICATORS,
                    payload=json.dumps(indicator_data),
                    headers=headers,
                )
                if response.status_code >= 200 and response.status_code <= 299:
                    response_json = response.json()
                    applogger.debug(
                        "{}(method={}) : {} : Created the indicator into the sentinel with status code {}"
                        " and got the response {}".format(
                            LOGS_STARTS_WITH,
                            __method_name,
                            RETRY_FAILED_INDICATORS,
                            response.status_code,
                            response_json,
                        )
                    )
                    return response_json
                elif response.status_code == 400:
                    applogger.warning(
                        "{}(method={}) : {} : trying again error 400 for indicatorId : {}.".format(
                            LOGS_STARTS_WITH, __method_name, RETRY_FAILED_INDICATORS, indicator_id
                        )
                    )
                    retry_count_400 += 1
                    time.sleep(SENTINEL_400_SLEEP)
                elif response.status_code == 429:
                    applogger.error(
                        "{}(method={}) : {} : trying again error 429.".format(
                            LOGS_STARTS_WITH, __method_name, RETRY_FAILED_INDICATORS
                        )
                    )
                    retry_count_429 += 1
                    time.sleep(SENTINEL_429_SLEEP)
                elif response.status_code == 401:
                    applogger.error(
                        "{}(method={}) : {} : trying again error 401.".format(
                            LOGS_STARTS_WITH, __method_name, RETRY_FAILED_INDICATORS
                        )
                    )
                    self.bearer_token = auth_sentinel(RETRY_FAILED_INDICATORS)
                    headers["Authorization"] = ("Bearer {}".format(self.bearer_token),)
                    retry_count_401 += 1
                else:
                    applogger.error(
                        "{}(method={}) : {} : url: {}, Status Code : {}: Error while creating microsoft"
                        " sentinel access_token. Error Reason: {}".format(
                            LOGS_STARTS_WITH,
                            __method_name,
                            RETRY_FAILED_INDICATORS,
                            create_indicator_url,
                            response.status_code,
                            response.reason,
                        )
                    )
                    raise CofenseException()
            applogger.error(
                "{}(method={}) : {} : Max retries exceeded for microsoft sentinel.".format(
                    LOGS_STARTS_WITH, __method_name, RETRY_FAILED_INDICATORS
                )
            )
            return None
        except CofenseException:
            raise CofenseException()
        except Exception as error:
            applogger.error(
                "{}(method={}) : {} : Error generated while creating indicator :{}".format(
                    LOGS_STARTS_WITH, __method_name, RETRY_FAILED_INDICATORS, error
                )
            )
            raise CofenseException()
To create indicator into Microsoft Sentinel.
Solutions/CofenseTriage/Data Connectors/CofenseTriageDataConnector/RetryFailedIndicators/sentinel.py