How to dynamically create a Video Indexer on Azure using Python SDK?

Daniel Pinto | Setwin 0 Reputation points
2024-07-24T15:34:06.45+00:00

I'm building a multitenancy app in Django.

When a Tenant is registered, I want to create an instance of an Azure AI Video Indexer dynamically.

This is my code snippet that creates the Azure Video Indexer:

    def create_video_indexer_instance(self, resource_group: ResourceGroup, tenant: Tenant, location: str = "westeurope") -> MediaService:
        media_service_name = f'mywise{tenant.subdomain}media'
        
        self.stdout.write(f"Creating storage account for Video Indexer in resource group '{resource_group.name}'...")
        vi_storage_account = self.create_storage_account(
            resource_group,
            tenant,
            location,
            f'mywise{tenant.subdomain}vistorage'
        )

        params = MediaService(
            location=location,
            storage_accounts=[
                { "id": vi_storage_account.id, }
            ]
        )

        self.stdout.write(f"Creating Video Indexer instance '{media_service_name}' in resource group '{resource_group.name}'...")
        
		operation = self.media_manager.mediaservices.begin_create_or_update(
            resource_group.name,
            media_service_name,
            params
        )

        media_service = operation.result()

        self.stdout.write(f"Video Indexer instance '{media_service_name}' created successfully.")

        return media_service

I get this error:

azure.core.exceptions.HttpResponseError: (BadRequest) Creation of new Media Service accounts are not allowed as the resource has been deprecated.
Code: BadRequest
Message: Creation of new Media Service accounts are not allowed as the resource has been deprecated.
Exception Details:	(MediaServiceAccountCreationDisabled) Creation of new Media Service accounts are not allowed as the resource has been deprecated.
	Code: MediaServiceAccountCreationDisabled
	Message: Creation of new Media Service accounts are not allowed as the resource has been deprecated.

I understand that Azure Video Indexer was retired from Media Services, just as announced.However, I tried to find a new way to do this in the official documentation, but I can't find it.
Can someone help me? Is there a new approach to make this? Where can I find it?

Thank you!

Azure AI Video Indexer
Azure AI Video Indexer
An Azure video analytics service that uses AI to extract actionable insights from stored videos.
84 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. VasaviLankipalle-MSFT 18,141 Reputation points
    2024-07-25T03:40:16.04+00:00

    Hello @Daniel Pinto | Setwin , Thanks for using Microsoft Q&A Platform.

    Over the past year, Azure AI Video Indexer (VI) announced the removal of its dependency on Azure Media Services (AMS) due to its retirement

    Please go through this documentation regarding, Features adjustments , changes and a migration guide provided.

    Regards,
    Vasavi

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.