Azure / azure-storage-net

Microsoft Azure Storage Libraries for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trying to create a container, inside a contaner

eduardoagr opened this issue · comments

Which service(blob, file, queue, table) does this issue concern?

Blob

Which version of the SDK was used?

12.14.1

Which platform are you using? (ex: .NET Core 2.1)

net6.0-windows10.0.19041.0

What problem was encountered?

I am trying to create a container inside of my user container

I already created my container users, inside the portal

but I want to create containers inside

How can we reproduce the problem in the simplest way?

run this method

` public string CreateStorageAzure(string id) {

       id = "d3o0ogaojjhzhzlozin42gsk9j62"

        ContainerClient = new BlobContainerClient(ConectionString,
            $"{ConstantsHelpers.AZURE_CONTAINER_USERSROOT}/" +
            $"{id}");

        Debug.WriteLine($"{ContainerClient.Name} - {ContainerClient.Uri}"); // users - https://transcribemedocs.blob.core.windows.net/users/d3o0ogaojjhzhzlozin42gsk9j62


        ContainerClient.CreateIfNotExists(
            Azure.Storage.Blobs.Models.PublicAccessType.BlobContainer);

        return ContainerClient.Name;
    }`

I also want to upload into that new container

`
public async Task UploadToAzureBlobStorage(string FilePath, string contaierName) {

        ContainerClient = new BlobContainerClient(ConectionString,
             $"{ConstantsHelpers.AZURE_CONTAINER_USERSROOT}/" +
             $"{contaierName}");

        var blob = ContainerClient.GetBlobClient(Path.GetFileName(FilePath));
        await blob.UploadAsync(FilePath, true);

        return blob.Uri.AbsoluteUri;
    }`

Error

Azure.RequestFailedException: 'The requested URI does not represent any resource on the server.
RequestId:b836b495-f01e-0042-5e0c-3fb45a000000
Time:2023-02-12T18:04:34.7989881Z
Status: 400 (The requested URI does not represent any resource on the server.)
ErrorCode: InvalidUri

Content:

InvalidUriThe requested URI does not represent any resource on the server.
RequestId:b836b495-f01e-0042-5e0c-3fb45a000000
Time:2023-02-12T18:04:34.7989881Z

Headers:
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: b836b495-f01e-0042-5e0c-3fb45a000000
Date: Sun, 12 Feb 2023 18:04:34 GMT
Content-Length: 244
Content-Type: application/xml
'

Have you found a mitigation/solution?

No

Creating a blob container in another blob container is not supported. You can only create blobs in a blob container.

This repo is for the deprecated SDK issues. This is a feature request on the storage service itself, not the SDK.

Please forward all feature requests to
https://azure.microsoft.com/en-us/support/community/