Code Monkey home page Code Monkey logo

azureresourceexplorer's Introduction

ARMExplorer

This project has dependencies on OAuth authentication.

Note: Guest user scenarios are not supported.

Instructions

  1. Clone this repository to your local drive.
  2. Open ARMExplorer.sln with VS 2017+ and compile.

Create AAD application

  1. Go to Azure Portal while logged in as an Org ID (i.e. not MSA) and create AAD Application. You may create an application on existing AAD directory or a new directory altogether.
  2. Select 'Azure Active Directory' and then 'App registrations' and click 'New application registration'
  3. Enter any name for application name and https://localhost:44300/manage as Redirect URIs and click 'Register'
  4. Once created, open the application
  5. On Authentication, check ID tokens (used for implicit and hybrid flows) in Implicit grant and hybrid flows and save.
  6. On API permissions, add Windows Azure Service Management API and check Access Azure Service Management for Delegated Permissions and save.

Fix AADClientId and AADClientSecret in codes

  1. Copy CLIENT ID and paste it in this line, replacing Environment.GetEnvironmentVariable("AADClientId").
  2. On Certificates & secrets section, create a client secret. Copy the key and paste it in the same file, replacing Environment.GetEnvironmentVariable("AADClientSecret").

Test with localhost

  1. Build the solution using VS.
  2. Starting running it in the debugger (F5).
  3. In browser, it should redirect to login page.
  4. Enter AAD account and password. Note: try account that is not in the same directly as the application. Note: currently this does not work with MSA account.
  5. You should be prompt with OAuth allow/deny page, do accept it.

Test ARM apis

  1. https://localhost:44306/api/token - show current token details.
  2. https://localhost:44306/api/tenants - show all tenants (AAD directory) user belongs to.
  3. and so on..

Test with Azure Websites

  1. Create Azure Websites with local git publishing enabled
  2. Add the site https url as the reply URL for AAD application
  3. Deploy the website by pushing the repository
  4. Set AADClientID and AADClientSecret appSettings
  5. To test, simply browse to the website and append the query string "?repository="

Running unit tests

  1. Unit test support is still evolving and the tests are located under ng\test directory.
  2. Tests are built using tsconfig.json file under ng folder.
  3. You will need to have tsc and node installed before you can run the tests. You can use npm for this.
  4. Navigate to ng directory and compile the files using 'tsc' and run the tests using 'node manageWithTests.js'
  5. Remember to update the tsconfig.json file when adding new test files.

Swagger specs

Swagger files can be found at https://github.com/Azure/azure-rest-api-specs. For web apps the specs can be found internally under bin\Hosting\Azure\GeoMaster\Swagger\Service.json

Adding Swagger specs

Swagger files for all ARM providers are under App_Data/SwaggerSpecs. To update specs for any provider, locate the folder corresponding to the specific provider under SwaggerSpecs and do the following:

  1. To update an API in an existing file replace the old file contents with the latest specs.
  2. To move API to a new file, you will have to delete the old API from the existing file apart from adding the new file(s).
  3. To delete an API , remove the API from existing files.
  4. To add new API, copy the new files to the provider folder.
  5. To add new provider, create a new folder for the provider under SwaggerSpecs and place all your files inside the folder. You might also need to add the provider name at https://github.com/projectkudu/AzureResourceExplorer/blob/master/App_Data/providernames.txt if doesnt already exist.
  6. When adding new files, make sure you include them in the csproj file. Ex:
    <Content Include="App_Data\SwaggerSpecs\Microsoft.CDN\cdn.json" />
  7. Note: Some spec files might have dependencies on external files using relative paths. In that case the external files also need to be copied over or the swagger will fail to parse completely. Ex: Swagger referencing external file - https://github.com/projectkudu/AzureResourceExplorer/commit/6ea99ea565ac1f69e20e7eb199c71c7119a58bb6#diff-bc13fca161c67ebe7f92e5965a8db19b10fb7927338a5a86e82e5236650142bdR3071 Fix - https://github.com/projectkudu/AzureResourceExplorer/commit/f038fbda41639362182ff3d2aeafa67eb0cab970

Create a pull request with your changes.

azureresourceexplorer's People

Contributors

ahmelsayed avatar bala16 avatar balag0 avatar bokobza avatar davidebbo avatar ericsten-msft avatar gbowerman avatar gsacavdm avatar jijohn14 avatar johndowns avatar kheiakiyama avatar linmeng08 avatar lukeslev avatar m0ns1gn0r avatar msabansal avatar ryanbormsft avatar saguiitay avatar shobak101 avatar shuyanwork avatar snobu avatar stuartleeks avatar suwatch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azureresourceexplorer's Issues

Permalink is broken when path has a space

e.g. the ARM path is:

https://management.azure.com/subscriptions/{sub}/resourceGroups/Default-Web-WestUS/providers/Microsoft.Insights/alertrules/CPUHigh%20TmpCloudDeploy?api-version=2014-04

The Explorer browser path is:

https://{explorer domain}/manage/subscriptions/{sub}/resourceGroups/Default-Web-WestUS/providers/Microsoft.Insights/alertrules/CPUHigh%2520TmpCloudDeploy

But trying to request this ails with a 404. It looks like the encoded space is confusing it.

Storage Account /services request fails

Retrieve a storage account, i.e., /resourceGroups/my-group/providers/Microsoft.ClassicStorage/storageAccounts/mystorage, works fine. Trying to drill down into the services, i.e., /resourceGroups/my-group/providers/Microsoft.ClassicStorage/storageAccounts/mystorage/services, spins forever. Fiddler shows a 400 Bad Request coming back.

Ability to show all providers

If I have a RG with only websites in it, I cant browse to say the "clasic.storage" RP to create a new storage resource within that RG.

This limits discoverability of features/functionality

Tab preservation causes unwanted behavior after deleting an object

Steps:

  • click on a Resource Group
  • Go to the second tab and click Delete

Result: you're still looking at the Delete button for the RG you just asked to delete, so it feels like something went wrong.

Wondering if trying to preserve tab is more trouble than it's worth...

Make the editor itself scrollable rather than the entire right section

Currently if the content in the text editor is long, the whole right part of the page scrolls. this is happening because I am setting the editor maxLines to Infinity.

Issues with that:

  • Performance: ace ends up rendering the whole document rather than what's currently visible, which may affect large documents load time and general page responsiveness
  • keyboard controls (arrows, Home, End, etc) don't work because the editor doesn't know what's visible and what's not.
  • the tabs section at the top disappears when you scroll

Benefits:

  • when you scroll the whole right section, you get a bigger editor area.

The alternative is to have the editor itself scrollable, that pretty much the opposite of what's above.

Thoughts?

Add support for $expand

e.g. VMs support:

/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Compute/virtualMachines/{mv}?api-version=2015-05-01-preview&$expand=instanceView

expand=instanceView means include the optional instanceView property in the response payload.

Potentially, explorer could turn that into a checkbox that turns on or off expand=instanceView in the path.

Add better support for large collections

Today, if a resource group contains thousands of sites, the UI will not behave well. We should find a way to handle this, e.g. by only showing the first 200 items by default.

Paging support in the underlying API can play a part there, though it's not yet implemented for Websites.

Explorer uses the wrong path for database GET

So it gets to the DB list GET and that works fine:

https://management.azure.com/subscriptions/{sub}/resourceGroups/Default-SQL-WestUS/providers/Microsoft.Sql/servers/qfhzpobzl2/databases?api-version=2014-04-01

returns

{
  "value": [
    {
      "id": "/subscriptions/{sub}/resourceGroups/Default-SQL-WestUS/providers/Microsoft.Sql/servers/qfhzpobzl2/databases/master",
      "name": "master",
      "type": "Microsoft.Sql/servers/databases",
      etc...

But when I click on a specific DB, it gets really confused and queries this path:

https://management.azure.com/subscriptions/{sub}/resourceGroups/Default-SQL-WestUS/providers/Microsoft.Sql/servers/master/databases/qfhzpobzl2?api-version=2014-04-01

Notice how it has /servers/master/databases/qfhzpobzl2, reversing the server name and db name! The ID that got returned from the list GET is actually correct.

ARMExplorer is broken in IE

Totally busted. Like the templates are not expanding, and it's displaying things like {{ treeControl.get_selected_branch().label }}.

Ability to log-out

I have 2 subscriptions under 2 different live id, having a log-out button would help switch between accounts without having to open in-private browsers etc...

Use /resources call to detect and filter API shape per resource group

Calling /subscriptions/{sub}/resources?api-version=2014-04-01 returns a list of all registered resources in the sub. e.g. entries look like:

/subscriptions/{sub}/resourceGroups/Default-Web-NorthEurope/providers/microsoft.insights/components/MvcApp
/subscriptions/{sub}/resourceGroups/Default-Web-NorthEurope/providers/Microsoft.Web/serverFarms/DefaultServerFarm
/subscriptions/{sub}/resourceGroups/Default-Web-NorthEurope/providers/Microsoft.Web/sites/MySite

This can be used as follows:

  • the first time a subscription node is expanded, we make a request to the server, which gets the resource list for that sub, and pre-processes it into the following data structure:
    /subscriptions/{sub}/resourceGroups/Default-Web-NorthEurope: {
        "microsoft.insights": [
            "components"
        ],
        "Microsoft.Web": [
            "serverFarms",
            "sites"
        ]
    }

Then in the UI, when a specific RG is expanded, we use this data to populate the list of providers, instead of the 'global' list.

Note that in addition to this, we'll need to query the list of registered resource types so that we can get the correct API version. That part can be done as part of the global metadata on the first request.

Searching after clicking on 'Show All' doesn't work

I think it's because after clicking on 'show all', we end up in a state where no node is selected.
We can either make sure 'show all' select a node after refreshing the tree or make search handle that condition. I prefer the former.

Read Only Mode

Support setting the whole portal in a ReadOnlyMode where no PUT, POST, or DELETE operations are allowed.

Provide status URL for long running operations

When doing a long-running operation like resourceGroups/X/providers/Microsoft.Web/sites/Y/slots/Z/slotsswap that has a x-ms-request-id, it'd be nice to automatically have the route to get its current status

Support showing what the code would look like in various platforms

e.g. you make a PUT call, and some pane shows you exactly what the code would look like in C# or Java (or whatever language we have SDKs for). Possibly even PowerShell using the low level CmdLets (high level would be hard as there is no metadata for the flags, ...).

Strange error after leaving the site up for many hours

All requests fail with a variant of this:

{
    "data": "",
    "status": 0,
    "config": {
        "method": "GET",
        "transformRequest": [
            null
        ],
        "transformResponse": [
            null
        ],
        "url": "api/subscriptions/9033bcf4-c3c2-4f82-9e98-1cc531f1a8a8/resourceGroups",
        "headers": {
            "Accept": "application/json, text/plain, */*"
        }
    },
    "statusText": ""
}

I'm guessing the token needs a refresh or something like that. Not a huge deal, as refreshing page fixes it.

Copy to clipboard button for those text areas

Often time I need to copy content and paste somewhere else, it is not easy to do so. Ctrl-A doesn't work as I want - it selects everything. If we could support Ctrl-A, Ctrl-C and Ctrl-V, that would do too.

Support explicit Edit mode

To make things a bit less confusing, it could work like this:

  • when doing a GET, to get a readonly pane that has exactly what came back from the request
  • to make changes, you click a button to go into 'edit mode', at which point we yank the readonly props, and shows the 'ghost' entries
  • when we don't have spec metadata, the edit mode would just be what came back from GET, and you're on your own (best we can do)

Support AD directory in path

e.g. it could support https://resources.azure.com/microsoft.com/subscriptions/etc... to make the directory explicit.

Confirm on Delete

Make sure to confirm on delete. Also special case deleting a resourceGroup to indicate that it might contain more resources than currently shown in ARMExplorer

Wrong node can get removed from tree

Steps:

  • create two resources groups, rg1 and rg2 (not from Explorer; I used ARMClient)
  • Go to rg1 and click delete
  • Without letting it complete, click on rg2 in the tree

Result: when the delete completes, rg2 gets yanked from tree instead of rg1. Closing and reopening resourceGroups node restores things.

Seems it assumes that whatever node you're on when the deletion completes is the one that was deleted, which is not always the case.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.