123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- def main():
- try:
- CloudCheckrApiKey = str(sys.argv[1])
- except IndexError:
- print("Must include an admin api key in the command line")
- return
- try:
- NameOfCloudCheckrAccount = str(sys.argv[2])
- except IndexError:
- print("Must include a cloudcheckr account name")
- return
- try:
- AzureDirectoryId = str(sys.argv[3])
- except IndexError:
- print("Must include an Azure Directory Id")
- return
- try:
- AzureSubscriptionId = str(sys.argv[4])
- except IndexError:
- print("Must include an Azure Subscription Id")
- return
- try:
- AzureAdminApplicationId = str(sys.argv[5])
- except IndexError:
- print("Must include an Azure Admin ApplictApi Id")
- return
- try:
- AzureAdminApplicationSecret = str(sys.argv[6])
- except IndexError:
- print("Must include an Azure Admin Application Secret")
- return
- try:
- AzureCloudCheckrApplicationName = str(sys.argv[7])
- except IndexError:
- print("Must include an Azure CloudCheckr Application Name")
- return
- try:
- AzureCloudCheckrApplicationSecret = str(sys.argv[8])
- except IndexError:
- print("Must include an Azure CloudCheckr Application Secret")
- return
- env = "https://glacier.cloudcheckr.com"
- AzureApiBearerToken = get_azure_bearer_token("https://management.azure.com/", AzureDirectoryId,
- AzureAdminApplicationId, AzureAdminApplicationSecret)
- AzureGraphApiBearerToken = get_azure_bearer_token("https://graph.microsoft.com/", AzureDirectoryId,
- AzureAdminApplicationId, AzureAdminApplicationSecret)
- AzureReaderRoleId = get_azure_reader_role_id(AzureApiBearerToken, AzureSubscriptionId)
- AzureCloudCheckrApplicationServicePrincipalId, AzureCloudCheckrApplicationId = get_azure_cloudcheckr_service_principal_id(
- AzureGraphApiBearerToken, AzureCloudCheckrApplicationName)
- set_azure_cloudcheckr_application_service_assignment(AzureApiBearerToken, AzureReaderRoleId,
- AzureCloudCheckrApplicationServicePrincipalId,
- AzureSubscriptionId)
- create_azure_account(env, CloudCheckrApiKey, NameOfCloudCheckrAccount, AzureDirectoryId,
- AzureCloudCheckrApplicationId, AzureCloudCheckrApplicationSecret, AzureSubscriptionId)
|