Search code examples
c#.netazureazure-media-services

How to create Windows Azure Media Services Access Policy without Duration or with a longer validity?


I've created Azure Media Services and everything works perfectly. I've the below policy for all the Locators for streaming assets.

await context.AccessPolicies.CreateAsync("My 30 days readonly policy", TimeSpan.FromDays(30), AccessPermissions.Read);

I understand that the above policy will expire in 30 days and I'll need to re-create it. I want this assets to publically available for as long as it exists.

What would be the best way to do this?

Thanks in advance...


Solution

  • Windows Azure Media Services does not support infinite access policy, but you can use following example to set up maximum possible expiration time:

    _mediaContext.AccessPolicies.CreateAsync("TimeSpan.MaxValue readonly policy", TimeSpan.MaxValue, AccessPermissions.Read);