Skip to content

Commit

Permalink
fix bucket bug + comtoffx (Azure#10148)
Browse files Browse the repository at this point in the history
  • Loading branch information
stavbella authored Mar 14, 2024
1 parent 1b9e842 commit ab3a987
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
Binary file modified DataConnectors/AWS-S3/ConfigAwsS3DataConnectorScripts.zip
Binary file not shown.
Binary file not shown.
Binary file modified DataConnectors/AWS-S3/ConfigAwsS3DataConnectorScriptsGov.zip
Binary file not shown.
11 changes: 9 additions & 2 deletions DataConnectors/AWS-S3/Enviornment/EnviornmentConstants.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
#GovToFFX
#$script:SentinelClientId = 'api://d4230588-5f84-4281-a9c7-2c15194b28f7'
#$script:SentinelTenantId = 'cab8a31a-1906-4287-a0d8-4eef66b95f6e'
#$script:CloudEnv = 'Gov'
#$script:AwsCloudResource = 'arn:aws-us-gov'


#ComToProd
$script:SentinelClientId = 'api://1462b192-27f7-4cb9-8523-0f4ecb54b47e'
$script:SentinelTenantId = '33e01921-4d64-4f8c-a055-5bdaffd5e33d'
$script:CloudEnv = 'Com'
$script:AwsCloudResource = 'arn:aws'
$script:AwsCloudResource = 'arn:aws'

#ComToFFX
#$script:SentinelClientId = 'api://d4230588-5f84-4281-a9c7-2c15194b28f7'
#$script:SentinelTenantId = 'cab8a31a-1906-4287-a0d8-4eef66b95f6e'
#$script:CloudEnv = 'Com'
#$script:AwsCloudResource = 'arn:aws'
7 changes: 5 additions & 2 deletions DataConnectors/AWS-S3/Utils/AwsResourceCreator.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,14 @@ function New-S3Bucket

Write-Log -Message "Executing: aws s3api head-bucket --bucket $bucketName 2>&1" -LogFileName $LogFileName -Severity Verbose
$headBucketOutput = aws s3api head-bucket --bucket $bucketName 2>&1
# If there was an error the bucket does not already exist or no permissions.
Write-Log -Message "output $headBucketOutput 2>&1" -LogFileName $LogFileName -Severity Verbose
Write-Log -Message "error code $lastexitcode 2>&1" -LogFileName $LogFileName -Severity Verbose

$isBucketNotExist = $null -ne $headBucketOutput
$isBucketNotExist = $lastexitcode -ne 0
if ($isBucketNotExist)
{
$bucketCreationConfirm = Read-ValidatedHost -Prompt "Bucket doesn't exist, would you like to create a new bucket ? [y/n]" -ValidationType Confirm
$bucketCreationConfirm = Read-ValidatedHost -Prompt "Bucket doesn't exist or you don't have permission to access it, would you like to create a new bucket ? [y/n]" -ValidationType Confirm
Write-Log -Message "Creating new bucket: $bucketCreationConfirm " -LogFileName $LogFileName -Indent 2

if ($bucketCreationConfirm -eq 'y')
Expand Down

0 comments on commit ab3a987

Please sign in to comment.