Perform file upload - Cloud Discovery API

Note

  • We've renamed Microsoft Cloud App Security. It's now called Microsoft Defender for Cloud Apps. In the coming weeks, we'll update the screenshots and instructions here and in related pages. For more information about the change, see this announcement. To learn more about the recent renaming of Microsoft security services, see the Microsoft Ignite Security blog.

  • Microsoft Defender for Cloud Apps is now part of Microsoft 365 Defender. The Microsoft 365 Defender portal allows security admins to perform their security tasks in one location. This will simplify workflows, and add the functionality of the other Microsoft 365 Defender services. Microsoft 365 Defender will be the home for monitoring and managing security across your Microsoft identities, data, devices, apps, and infrastructure. For more information about these changes, see Microsoft Defender for Cloud Apps in Microsoft 365 Defender.

Upload the file contents by performing an HTTP PUT request. You will be required to use the URL returned by the Initiate file upload request.

Azure and AWS have different headers and limitations when uploading files to the target URL.

Note

  • You can upload individual files of up to 5 GB. If you need to upload larger files, break the Cloud Discovery data into multiple chunks.
  • If you do not know which environment you are running, check the Initiate file upload request, which returns this information.

HTTP request

PUT https://<initiate_file_upload_response_url>

Note

For Azure:

  • If your file is under 64 MB, add the header "x-ms-blob-type: BlockBlob" to your request.
  • If your file size is greater than 64MB, upload it in chunks. the easiest way to do this is using the Azure SDK.

Example

Request

Here is an example of the request for Azure.

curl --request PUT --upload-file <file_to_upload> -H "x-ms-blob-type: BlockBlob" "https://<initiate_file_upload_response_url>"

Here is an example of the request for Azure Java SDK.

File fileReference = new File("file.name");
// Create a blob using the URI that contains the shared access signature.
CloudBlockBlob sasBlob = new CloudBlockBlob(uri);

// Upload the file to the blob.
sasBlob.upload(new FileInputStream(fileReference), fileReference.length());

If you run into any problems, we're here to help. To get assistance or support for your product issue, please open a support ticket.