Create and Publish Azure classic Cloud Service project with AzureRM powershell - powershell

Even after looking at the docs, I couldn't find a way to do this with the AzureRM powershell cmdlets. Does anyone know how to do this?
The old Azure Service Management powershell cmdlets have a Publish-AzureServiceProject, but I believe it is deprecated now.
EDIT: Supplement Answer to yoape's answer below
You can create a new classical cloud service project using something like this:
New-AzureRmResource -ResourceType "Microsoft.ClassicCompute/domainNames" -Location "centralus" -ResourceName "myCloudServiceProjectName" -ResourceGroupName "myResourceGroup"
Where Microsoft.ClassicCompute/domainNames is the magic sauce one needs to create the desired classic cloud service project.
However, (afaik) you will still need to deploy/publish the classic cloud service via the old cmdlet: Publish-AzureServiceProject. Using the above cmdlet lets you create the cloud project in the proper resource group though.

The classic compute services are basically not supported by the Azure Resource Manager model. This means you cannot use the AzureRM cmdlets for publishing your Cloud Services.
The Publish-AzureServiceProject cmdlet from ASM is not depricated (yet), you can still use it (in fact it is still the only way to publish your Cloud Service from PowerShell). Perhaps you where thinking about the deprecation of the Switch-AzureMode cmdlet?

Related

How to add PowerBI Gateway to existing cluster using PowerShell Cmdlets?

I managed to install PowerBI Gateway programatically
Install-Module -Name DataGateway -Force -Scope AllUsers
Login-DataGatewayServiceAccount
Install-DataGateway -AcceptConditions
Now I am looking for a way to add this gateway to existing cluster. There is a function to remove gateway Remove-DataGatewayClusterMember, but for some reasons there is no function to add.
Is there anyway to add PowerBI Gateway to existing cluster using PowerShell Cmdlets or something else?
No, there is no way to add a cluster to an existing gateway. That cmdlet will only setup and create a new gateway cluster with the machine. Suggest you submit feedback for the Microsoft Power BI team here:
https://ideas.powerbi.com/
You cannot do it via Powershell as of today but you definitely do it using the UI. Here is an article that can help you.
add-another-gateway-to-create-a-cluster

Get-AzureNetworkSecurityGroup not working

I try too add some Security roules in my Azure NSG via Powershell, but
Get-AzureNetworkSecurityGroup
doesn't seem to work, it alway returns nothing. I can't select a NSG by Name too
Get-AzureNetworkSecurityGroup -Name myname
Although
Find-AzureRmResource -ResourceNameContains nsg
finds my NSGs.
What do I do wrong?
Thanks
Get-AzureNetworkSecurityGroup is meant for NSG's created using the classic deployment model (Old Portal). This will yeild output only if you have classic NSG's in your subscription.
You have indicated that you get output when you use the Find-AzureRmResource commandlet. Now this is a commandlet for the resources created using the ARM deployment model in Azure. One easy way to identify the Resource Manager commandlets is to look for the letters RM in the commandlet.
Looks like you have NSG's created using Resource Manager, so try the following:
Get-AzureRmNetworkSecurityGroup -Name nsg1 -ResourceGroupName "KaushalRG"
Looks for network security group "nsg1" in resource group "KaushalRG"
More information on the deployment models in Azure can be found here: Azure Resource Manager vs. classic deployment

TFS - No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription

I am trying to run a task on TFS which requires AD set up. I managed to set up all connections, but for some reason Subscription on TFS is not selected.
I am not sure to what account do I have to log in, to set default subscription. -Default parameter is deprecated btw.
Task add-on I am trying to use is downloadable here:
https://marketplace.visualstudio.com/items?itemName=rbengtsson.appservices-start-stop&showReviewDialog=true
TFS build error:
I tried to set up via power-shell:
I have tested the Azure AppServices Stop task on my side, and found this task works perfectly with Azure Classic Connection Type, but while used Azure Resource Manager Connection Type, I got the same error message as you.
According to the source code of Azure AppServices Stop task on GitHub, this task actually uses Azure Power Shell below to stop the service:
$website = Get-AzureWebsite -Name $WebAppName
Stop-AzureWebsite -Name $WebAppName
It seems Stop-AzureWebsite only works with Azure Classic, as we can't find it in Using Azure PowerShell with Azure Resource Manager.
In conclusion, if you want to use Azure AppServices Stop task, you need to choose Azure Classic Connection Type:
Using the latest version of AzureRM Powershell you now can use Azure Resource Manager connection type and use commands like:
Start-AzureRmWebApp
Stop-AzureRmWebApp

Azure AD - Custom Application Roles via Powershell

I've been playing with RBAC in Azure AD, in particular custom application roles.
It all works well, but is a bit manual, i.e. downloading, editing and uploading the manifest and then assigning each user/group to one of these roles via the management portal.
Is there a way to do that via powershell or even code, say the Graph API?
If not, I presume it's a planned feature, so does anyone know a the likely ETA?
Right now this feature is not available via the AAD PowerShell Module, but it will find its way there eventually. We are working on releasing a new PowerShell module soon that sits atop ADAL which means we will soon be making cmdlets that directly target the Graph API.
For now, you can make direct queries using the Graph Client Library or pure REST calls. I believe an example of setting Application Roles should be available in this sample:
https://github.com/Azure-Samples/active-directory-dotnet-graphapi-console
I hope this helps!
Shawn Tabrizi
Before you can use Windows PowerShell to manage RBAC, you must have the following:
Windows PowerShell, Version 3.0 or 4.0. To find the version of Windows PowerShell, type:$PSVersionTable and verify that the value of PSVersion is 3.0 or 4.0.
Azure PowerShell version 0.8.8 or later.
To get detailed help for any cmdlet that you see in this tutorial, use the Get-Help cmdlet.
Get-Help <cmdlet-name> -Detailed
For example, to get help for the Add-AzureAccount cmdlet, type:
Get-Help Add-AzureAccount -Detailed
Since RBAC only works with Azure Resource Manager, the first thing to do is to switch to Azure Resource Manager mode, type:
PS C:\> Switch-AzureMode -Name AzureResourceManager
Here is the complete tutorial on
https://azure.microsoft.com/en-us/documentation/articles/role-based-access-control-powershell/

How to use PowerShell to get information about a Staging Windows Azure WebSite slot?

I'm using the PowerShell CmdLets to automate most tasks against Windows Azure Cloud Services and Windows Azure Web Sites.
For Cloud Services, I can use the Get-AzureDeployment CmdLet. However, the similar Get-AzureWebSiteDeployment CmdLet requires Git to be installed before it can run and does not seem to be designed for the same task.
As far as I can see, the Get-AzureWebSite CmdLet only ever retrieves the "Production" slot of a Windows Azure Web Site.
How is it possible to get programmatic access to the corresponding "Staging" slot ?
We are working on some PowerShell cmdlets to support website slots. We are very close to releasing it. Keep an eye on this repo on github. https://github.com/WindowsAzure/azure-sdk-tools
Current date update (Jul 19 2015):
According to Azure Docs Web Sites Staging Slots there are new CMDLets that support querying Slots:
Show-AzureWebsite -Name webappslotstest -Slot staging
And some others cmdlets extended with -Slot attribute (Create New Website, Remove, Switch Slots).