How do I sign in to my Azure account from the VSCode Azure Functions extension? - azure

I have been trying to create an Azure Function using the documentation. For example, here:
https://learn.microsoft.com/en-us/learn/modules/develop-azure-functions/5-create-function-visual-studio-code
Every time, and with every Azure account, I can't get past the step where you sign in to your Azure account from the Azure Functions VSCode extension. This is the error I am getting:
"Selected user account does not exist in tenant 'Microsoft Learn Sandbox' and cannot access the application 'aebc6443-996d-45c2-90f0-388ff96faa56' in that tenant. The account needs to be added as an external user in the tenant first. Please use a different account."
The Microsoft Learn Sandbox error message is a red herring to me, as I am not trying to do anything with it, only with Azure Functions. The same error appears even with a completely different Azure account.
I have tried looking at several possible solutions, including switching directories (but I only have one directory, so this didn't work), changing settings in Azure AD Connect (but I don't have Azure AD Connect configured, so this didn't work), and I deleted several local .config files and directories on my machine (CentOS 7, btw). If the solution is related to my .config files, I couldn't tell which files I should actually be deleting though.

In my situation, the problem is it was trying to use my "learning" account but I wanted to use my "work" account.
Following the answer here: https://learn.microsoft.com/en-us/answers/questions/696758/how-do-i-sign-in-to-azure-from-vs-code?page=1&orderby=Helpful&comment=answer-697695#newest-answer-comment
Go to the Azure portal and sign out (https://portal.azure.com/) Now
open Visual Studio and Open the Command Palette (Ctrl + Shift + P)
search for Azure: Sign Out and click on it. It will signout you from the Visual Studio extension
Then (this is the important part) it allowed me the option to Clear my Tenant ID.
Then you can sign in again with the new account
Hope this helps someone else!

Related

Creating an Azure Function in existing Function App on existing Subscription and Resource Group

I've developed a time triggered function in Microsoft Azure Functions with my personal subscription. The process made me create everything I needed from scratch in Visual Studio Code.
Now I would like to deploy the same function on a different subscription in which someone else have created a resource group, a function app and a storage account.
I'm not able to add these existing resources. Looks like from inside Visual Sudio Code I can only create a new resource group, storage account and function app in the same subscription as before even though I've signed out with my personal account and logged into the customer provided account.
Am I missing something obvious? Can someone point me in the right direction?
In Visual Studio Code you can select the Azure Subscription to which deploy your functions by opening the Azure tab on the left side menu (or Alt + Shift + A shortcut) and by clicking the "Select subscription" button under the "Functions" tab of that menu (see screenshot below).
screenshot
If your account has multiple subscriptions, then click this icon to select the other subscription where you need to deploy your function app or any other app as you can see in the below image:
even though I've signed out with my personal account and logged into the customer-provided account.
If the customer's subscription is available in your account, though you logged out from the account, it may have shown your subscriptions at the azure extension.
Press Ctrl + Shift + P in your VS Code, which opens the command palette.
Click on Azure: Sign Out for complete sign out in VS Code.
If you signed in again to the VS Code through Command Palette or Account extension on the sidebar, sync will not happen automatically. So, Click on Sign in to Sync settings which logs you to your Microsoft account to verify again.
Make sure this setting is turned on whichever the account (Customer's or Your Subscription) you logged in to VS Code.
This setting helps you to deploy your applications with any subscription in your account through the VS Code Editor.
Although other responses were useful to me and might prove useful to others, my specific problem was caused by the "Azure: Tenant" setting in the Visual Studio Code Settings.
This setting basically sets a specific subscription to use (identified by its ID). Once removed, with this field empty, the default behavior of the extension is to ask each time where to deploy a function.
As soon as I removed the value for this setting the second subscription appeared in Azure extension panel.

Azure active directory - Unable to delete

I have two additional AD I have created in addition to the one which is associated to the subscription. I want to delete those but my attempt fails with the message "Directory has one or more applications that were added by a user or administrator"
I can see below two common application in both directories, where I don't see a delete button.
Office 365 management apis
Visual Studio Team Services
How can I delete this AD?
Thanks,
Shiju
I ran into the same issue. The only solution I was able to find was to step into PowerShell and get it done. You can find the steps in these two posts:
https://social.msdn.microsoft.com/Forums/en-US/afbfb7b3-92c9-4af6-9128-ba96795de5a6/not-able-to-delete-b2c-tenant
https://social.msdn.microsoft.com/Forums/en-US/e041555c-aa36-4369-bbb9-1f23ae317304/how-to-remove-active-directory-from-windows-azure
The main gist is that you need to have a global admin account which is a direct member of the directory. You can't use your Microsoft/subscription account even though it may have been granted global admin permissions. You then connect using these credentials in PowerShell, find the Service Principals (aka Applications) which exist, and remove them. You can then drop the Admin account for the directory and delete the directory itself.
I also wrote a blog page on how to delete an active directory tenant. I have updated the process to use the new portal and the newer AzureAD PowerShell cmdlets.
https://blog.nicholasrogoff.com/2017/01/20/how-to-delete-an-azure-active-directory-add-tenant/

Azure Tools for VS - can't sign in to subscription

I'm having a pretty strange issue with Azure tools for VS 2013 (version 2.6). Whenever I try to sign in to my Azure subscription (e.g. from Server explorer or creating a new web role project) I get the following error:
Server Explorer
An error occurred during the sign in process: User 'foo#gmail.com' returned by service does not match user 'bar#outlook.com' in the request
OK
My subscription owned by 'bar#outlook.com' and I can perfectly fine sign in either to management portal in a browser (IE, Spartan and Chrome) - as well as in the Power Shell. Tried everything - cleaning up browser caches/cookies, resetting IE settings, playing with different IE security settings - nothign works.
Any help is appreciated - this issue drives me crazy.
P.S. I'm on Windows 10...
I had the same problem. Imported the certificate manually and everything worked ok: https://social.technet.microsoft.com/Forums/en-US/9cdafeb4-f459-436d-b2b8-9bc5c01f0df1/azure-tools-for-vs-cant-sign-in-to-subscription?forum=windowsazuredevelopment
I had this issue, to resolve it I:
Added 'foo#gmail.com' as an alias in my 'bar#outlook.com' Microsoft account, via account.live.com
Made the 'foo#gmail.com' email address the primary alias for my Microsoft account
I could then log in successfully in to Azure by pressing the Connect to Microsoft Azure button in the toolbar of the Server Explorer in Visual Studio 2013 and see all of my websites under the App Service node.
(When I'd used the certificate method described in the other post and Microsoft documentation I'd been able to see all my sql databases etc. but not the websites.)
Once I'd done all that I then switched my primary alias back to 'bar#outlook.com' and server explorer carried on working.
NB: If you're experimenting with this beware that there is a limit on how many times you can switch your primary.. as I have just discovered.. and now my primary is stuck on the wrong email address for a week.
NB2: If your connecting in order to be able to remote debug the website, then this can still be done by going to Visual Studio>Main Menu>Debug>Attach To Process, and then enter the URL of the site (without the http bit, e.g. mysite.azurewebsites.net) as the Qualifier and then attach to the w3wp.exe process.
I am having the exact same issue. It seems that the Azure sign-in in Visual Studio is redirecting to our organizational Single Sign-On instead of the Microsoft one. I have managed to work around this problem by using a Microsoft account that is not tied to my organization:
Create new Microsoft account or use an existing account not associated with your organization
In https://manage.windowsazure.com select Subscriptions/Manage Administrators
Choose Add+ and add the new Microsoft account as administrator to your subscription
Log on to Azure using the new account from Visual Studio
/Morten
I changed my Microsoft account's email address and had this problem. Adding an alias did not help.
The problem is to do with the Azure Active Directory Library for DotNet. For whatever dumb reason, they throw an exception when Azure returns an ID different than the one requested (if the server isn't crying about it, why make up an error and make the client deal with it?).
Since Azures's support was no help, I had to build a custom copy of the ADAL with that moronic exception removed and an assembly version matching the one used in VS2013 (2.11). Also importantly, disable strong name verification for the custom assembly.

How do I delete an application from azure active directory?

The title of my issue is clear enough by itself I hope....
I have only one application in my Applications list in Azure Active Directory. I would like to delete that, because it was only for experimental purposes.
But I cannot delete it, the delete icon in the drawer is greyed.
What can I do to delete the application from AAD?
For those coming by later and are using the new (preview) Azure Portal and are trying to remove a Native App;
The issue is due to the availableToOtherTenants setting, which you can not edit in the UI at the moment of writing. However, you can add the Manifest manually through the Azure Portal and edit the setting. After the edit, you can remove the app.
If it's a multi-tenant app, you need to convert it back to a single-tenant app before you can delete it. Please confirm that the setting 'Application is Multi-Tenant' (on the configure tab) is set to No.
Just adding to this - make sure that you are the owner of the application - if you're not, assign yourself ownership and delete will be enabled.
Unable to delete Azure AD due to Enterprise Apps (Delete grayed out)
Login to a Powershell (Admin)
Install-Module -Name MSOnline
connect-msolservice
(Provide GA Creds)
CAUTION: Following step may delete all the objects/applications recursively and may present multiple errors as well, but in the end, all this will help you to be finally able to delete the Azure AD instance successfully
Get-MsolServicePrincipal -All | Remove-MsolServicePrincipal
Sign-out and Sign-in Azure Portal
All enterprise apps will now be deleted --> You can Delete Azure AD Directory now
Whilst old, I stubmled across this issue earlier and found this post.
The portal has changed and none of the above worked for me (although I did not edit the manifest) - what I did do was go into AAD > Enterprise Applications and, from there, I could delete the Native applications.
Hope this helps someone (possibly me!) later.

Windows Azure Publish Website- "Unable to get subscription information. An item with the same key has already been added"

I'm following this tutorial here
http://www.windowsazure.com/en-us/develop/net/tutorials/get-started/#nextsteps
I'm at step 3. I click import, I can see I'm signed in with my MSDN ultimate account (I get $150 per month to spend on Azure). I then click New, and when the dialogue opens I cannot enter anything (all boxes are disabled), along with an error message in red:
http://gyazo.com/17eb15f07d54e2867cd5f21d377f04aa
Why is this? It is something with my MSDN account?
You can get also this problem if your MS account is registered with more than one Azure subscription. It appears Visual studio gets confused if your account is attached to more than one subscription and tries to use the wrong one for accessing the Azure API.
If it occurs you need to ignore the advice from #Dev Trails and instead do the following:
In Server Explorer, right-click Windows Azure node > Manage Subscriptions
In the Certificates tab Import a new subscription certificate (this will take you to the current link on the Azure portal to download your
certificate)
In the Subscriptions tab, on the specific subscription that fails,
select the drop-down and choose the certificate instead of the
username.
Refreshing the Azure explorer should now show your databases etc without error.
This is a bug in Visual Studio 2013. Found an answer posted here:
To workaround the issue, you can try the following:
In Server Explorer, right-click Windows Azure node > Manage Subscriptions
If you are signed-in to Azure, you will see the same subscription show up both in the Accounts tab and in the Certificates tab. Remove the one in the Certificates tab.
VS 2015: delete all MS Account from VS. Add once again.

Resources