Azure Media Services (v3) - specific output asset container name

血红的双手。 提交于 2021-02-08 06:10:52

问题


I have a program similar to AMSV3Quickstarts example and I need to change the default name for container for the output asset in accordance with my program logic/contract. Is it possible to change the output asset container name somehow?

What I tried:

  • RTFM
  • Change the transform job name
  • Change the locator name
  • Change the output asset name

However, in my blob storage, it is still in asset-{GUID} format.


回答1:


When using the REST API for Create Asset you are able to set the container name:

https://management.azure.com/subscriptions/:subscriptionId/resourceGroups/:resourceGroupName/providers/Microsoft.Media/mediaServices/:accountName/assets/:assetName?api-version={{api-version}}

{
  "properties": {
    "description": "A documentary showing the ascent of Mount Logan",
    "alternateId": "(Optional) some GUID",
    "storageAccountName": "(Optional) someStorageAccount",
    "container": "(Optional) custom container name if you want"
  }
}

When using the .NET SDK, the Asset model contains the same parameters: https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.management.media.models.asset?view=azure-dotnet




回答2:


Thank you for your really quick answer! You are right, working like a charm. I really appreciate your answer.

For the future me (and others) this is the working code:

        private static async Task<Asset> CreateOutputAssetAsync(IAzureMediaServicesClient client, string resourceGroupName, string accountName, string assetName)
        {
            Asset asset = new Asset();
            asset.Container = "mycustomnameformycontainer";
            string outputAssetName = assetName;

            return await client.Assets.CreateOrUpdateAsync(resourceGroupName, accountName, outputAssetName, asset);
        }


来源:https://stackoverflow.com/questions/58647595/azure-media-services-v3-specific-output-asset-container-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!