Upcoming breaking changes in the cmdlet 'Add-AzAnalysisServicesAccount'

Khushboo Dubey (Health) 26 Reputation points
2022-08-24T04:45:04.12+00:00

I have a PowerShell script which create AAS after some check.
now during release ,we see warning that "Upcoming breaking changes in the cmdlet 'Add-AzAnalysisServicesAccount'".

How to handle this?
below is the piece if code where it is used :

#Output this to null so its not returned via function  
$null =  Add-AzAnalysisServicesAccount -RolloutEnvironment "$modelRegion.asazure.windows.net" -Credential $userCredential
Azure Analysis Services
Azure Analysis Services
An Azure service that provides an enterprise-grade analytics engine.
444 questions
0 comments No comments
{count} votes

Accepted answer
  1. MartinJaffer-MSFT 26,061 Reputation points
    2022-08-24T20:52:51.677+00:00

    Hello @Khushboo Dubey (Health) and welcome to Microsoft Q&A.

    As I understand the ask, you want to know what to do to replace the Add-AzAnalysisServicesAccount.

    TL;DR / short answer: Replace with Connect-AzAccount

    ----------

    Long Answer:
    The story is a little convoluted. First I checked the REST API for a similar command. There was none. So I decided to take a closer look.

    The description of Add-AzAnalysisServicesAccount sounds like it should be provisioning a service principal in order to use the database commandlets.

    To gain certainty, I decided to run this command and see what side effects there are. To my surprise, this command didn't seem to really do anything when I ran in cloud shell! So I tried running from windows powershell. When run from windows powershell without arguments, it just asked me to log in. Nothing else happened beyond the deprecation warnings.
    So I tried again with bad credentials. No error was thrown. Now thorougly confused, I asked my colleage in the SDK area for help. We took a look inside the code. As best as I can tell, Add-AzAnalysisServicesAccount just does Connect-AzAccount using the credentials and other parameters you supply.

    This seemed strange, and not cogent to the verb "Add-". Looking closer, this command is aliased to Login-AzureAsAccount. Now it begins to make more sense.

    Documentation excerpt

    Permissions
    Most PowerShell tasks require you have Admin privileges on the Analysis Services server you are managing. Scheduled PowerShell tasks are unattended operations. The account or service principal running the scheduler must have Admin privileges on the Analysis Services server.

    For server operations using Azure PowerShell cmdlets, your account or the account running scheduler must also belong to the Owner role for the resource in Azure role-based access control (Azure RBAC).

    So to use the other commands, the user/service principal must have the appropraite RBAC role. When you open a powershell prompt, by default it is running as YOU. If you want it to run under service principal, then powershell must log into Azure as said service principal. That is what Add-AzAnalysisAccount does.

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

0 additional answers

Sort by: Most helpful