title: Getting an error while retrieving a blob using user assigned managed identity
body: <p>We have a C# code which used to retrieve a blob from storage account. The authentication is done using user assigned service principal. These things works till December. But now we are getting some weird error as follows.</p>
  <blockquote>
  <p>ManagedIdentityCredential authentication unavailable. The requested identity has not been assigned to this resource.<br />
  Status: 400 (Bad Request)<br />
  Content:<br />
  {&quot;error&quot;:&quot;invalid_request&quot;,&quot;error_description&quot;:&quot;Identity not found&quot;}</p>
  </blockquote>
  <p>The managed identity has storage data blob contributor access in the storage account.</p>
  <p>Attaching the code for reference:</p>
  <pre><code>public static async Task&lt;string&gt; GetBlobAsync()
      {
          string storageName = &quot;storage account name&quot;;
  
  
          Uri blobUri = new Uri(&quot;blob uri&quot;);
  
  
          TokenCredential cred = new ManagedIdentityCredential(&quot;client id&quot;);
  
  
          var blobClient = new BlobClient(blobUri, cred, null);
  
          try
          {
  
              var downloadInfo = await blobClient.DownloadAsync();
              using (TextReader reader = new StreamReader(downloadInfo.Value.Content))
              {
                  string metadataBlob = await reader.ReadToEndAsync();
  
                  return metadataBlob;
              }
          }
          catch (Exception e)
          {
              Console.WriteLine(e.Message);
              Console.WriteLine(&quot;&quot;);
              return null;
          }
  </code></pre>
  <p>P:S: the three environmental variables such as <code>app id</code>, <code>app secret</code> and <code>tenant id</code> are correct.</p>
  <p>I have been stuck here for almost a month. Nothing works.</p>