Giter Club home page Giter Club logo

azure's Introduction

Azure PowerShell & CLI

Azure PowerShell & CLI scripts developed while working with customers in the field


Add-AzDevOpsSecurityGroupMember

Adds an array of members to an Azure DevOps security group

# add members to security group
$addMembers = @{
    azDevOpsOrgUrl    = "https://dev.azure.com/foo";
    azDevOpsProject   = "bar";
    azDevOpsPAT       = "<personal_access_token>";
    securityGroupName = "Foo Bar SG";
    memberArray       = @(
        "[email protected]",
        "[email protected]"
    );
};

Add-AzDevOpsSecurityGroupMember @addMembers;

Enable-LogicAppDiagnostics

Enables the diagnostic setting on the target Logic App and forwards the telemetry to the specified Log Analytics workspace

$logAnalyticsResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg-telemetry/providers/microsoft.operationalinsights/workspaces/log-rohopkin";
$logicAppResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/RG-LogicApp-DevOps/providers/Microsoft.Logic/workflows/HTTP-Post";

Enable-LogicAppDiagnostics -logAnalyticsResourceId $logAnalyticsResourceId -logicAppResourceId $logicAppResourceId;

Get-AzVMImageData

Gets virutal machine image offers and SKUs available in the marketplace for the specified region

$location = "westus2";
$publisherName = "MicrosoftWindowsServer";
$offerName = "WindowsServer";

# This will return the available offers for the given publisher
#Get-AzVMImageData -location $location -publisher $publisherName;

# This will return the available SKUs for the given publisher's offer
Get-AzVMImageData -location $location -publisher $publisherName -offer $offerName;

Get-AzVnetNextAvailableCidrBlock

Gets the next available CIDR block for the specified VNet

$vnetResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/RG-Network/providers/Microsoft.Network/virtualNetworks/VNET-DMZ-01";
$cidrBlock = 26;

Get-NextAvailableCidrBlock -vnetResourceId $vnetResourceId -cidrBlock $cidrBlock;

Get-AzWebAppDeployers

Gets the distinct deployers (ADO/VSTS, FTP, etc.) for the specified web app

$appResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/RG-AzureFunctionDemo/providers/Microsoft.Web/sites/salmonapi";

Get-AzWebAppDeployers -resourceId $appResourceId;

New-AzDevOpsSecurityGroup

Creates a new security group in the specified Azure DevOps project. Use the memberArray switch to add existing members to the security group

# create security group
$newSG = @{
    azDevOpsOrgUrl           = "https://dev.azure.com/foo";
    azDevOpsProject          = "bar";
    azDevOpsPAT              = "<personal_access_token>";
    securityGroupName        = "Foo Bar";
    securityGroupDescription = "Foo bar description can go here";
};
New-AzDevOpsSecurityGroup @newSG;


# create security group and add members
$newSG = @{
    azDevOpsOrgUrl           = "https://dev.azure.com/foo";
    azDevOpsProject          = "bar";
    azDevOpsPAT              = "<personal_access_token>";
    securityGroupName        = "Foo Bar2";
    securityGroupDescription = "Foo bar description can go here";
    memberArray              = @(
        "[email protected]",
        "[email protected]"
    );
};
New-AzDevOpsSecurityGroup @newSG;

New-AzDevOpsServiceConnection

A very simple example to create a Veracode Service Connection in the target ADO project.

$serviceConnName = "VeracodeSample"
$vercodeApiId    = "88b73ca2-ee8f-4719-93a9-71b65ecaca8c"
$veracodeApiKey  = "inh34ih5lfw7xsxm4lmeliqodfnjsrgfdslkfseawaerd2a"
$orgName         = "hoppy7"
$projectName     = "Azure"
$patToken        = "fnhskfghsufmsd;lfksd;fjsfbhdsfjsdlfknslmgfmngdgdfsgvs"

New-AzDevOpsServiceConnection -serviceConnName $serviceConnName -vercodeApiId $vercodeApiId -veracodeApiKey $veracodeApiKey -orgName $orgName -projectName $projectName -token $patToken;

New-KeyvaultSelfSignedCertificate

Creates a self-signed certificate and adds the .PFX and password to Keyvault as certificates and secrets

$subjectNames = "myapi.foobar.net";
$keyvaultResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/RG-KeyVault/providers/Microsoft.KeyVault/vaults/kv-rohopkin";

New-KeyvaultSelfSignedCertificate -subjectNames $subjectNames -keyvaultResourceId $keyvaultResourceId;

Parse-ResourceId

Parse the resourceId of Azure resources

$resourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/RG-KeyVault/providers/Microsoft.KeyVault/vaults/kv-rohopkin";
$parsedId = Parse-ResourceId -resourceId $resourceId;

$parsedId;

Name                           Value
----                           -----
subscriptionId                 00000000-0000-0000-0000-000000000000
vaults                         kv-rohopkin
resourceGroup                  rg-keyvault

.........

$resourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/RG-AzureFunctionDemo/providers/Microsoft.Web/sites/salmonapi";
$parsedId = Parse-ResourceId -resourceId $resourceId;

$parsedId;

Name                           Value
----                           -----
subscriptionId                 00000000-0000-0000-0000-000000000000
sites                          salmonapi
resourceGroup                  rg-azurefunctiondemo

Recover-AzDeletedStorageAccount

Lists storage accounts recently deleted within the past 14 days for the provided subscriptionId, and recovers the accounts inluding the data.

Recover-AzDeletedStorageAccounts -subscriptionId "00000000-0000-0000-0000-000000000000"

Update-AzVmSize

Resize an Azure virtual machine

$vmResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/RG-DEVELOPMENT/providers/Microsoft.Compute/virtualMachines/vmdev01";
$newVmSize = "Standard_DS5_v2";

Update-AzVmSize -vmResourceId $vmResourceId -newVmSize $newVmSize;

azure's People

Contributors

hoppy7 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.