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:
However, in my blob storage, it is still in asset-{GUID}
format.
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
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);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.