Search code examples
azureazure-storageazure-cli

Azure CLI - Default to Microsoft Entra authorization in the Azure portal - how?


I am trying to use the Azure CLI (bash) to create a storage account and set the "Default to Microsoft Entra authorization in the Azure portal" property to "Enabled" (as shown below):

enter image description here

There does not seem to be an option on the Azure CLI storage account create command to do this -- or more likely, I am missing which option to include.

Can this be done via the Azure CLI?

I did try this solution, but it had no effect (The setting was still "Disabled").


Solution

  • Default to Microsoft Entra authorization in the Azure portal - how?

    You can use the below command to enable the Default to Microsoft Entra authorization in the Azure portal via Azure CLI commands.

    Command:

    az storage account update -g <Resource grp name> -n <Storage account name> --set defaultToOAuthAuthentication=true
    

    Output:

    PS /home/xxxx> az storage account update -g xxxx -n venkat678 --set defaultToOAuthAuthentication=true 
    {
      "accessTier": "Hot",
      "accountMigrationInProgress": null,
      "allowBlobPublicAccess": true,
      "allowCrossTenantReplication": false,
      "allowSharedKeyAccess": true,
      "allowedCopyScope": null,
      "azureFilesIdentityBasedAuthentication": null,
      "blobRestoreStatus": null,
      "creationTime": "xxxx,
      "customDomain": null,
      "defaultToOAuthAuthentication": true,
      "dnsEndpointType": null,
      "enableHttpsTrafficOnly": true
    

    enter image description here

    Portal:

    The above command executed and enabled the Default to Microsoft Entra authorization in the Azure portal.

    enter image description here

    Reference:

    az storage account | Microsoft Learn